After installing ZfcBase and ZfcUser in my app I get the error message:
'Module (ZfcUser) could not be initialized.' in Zend/ModuleManager/ModuleManager.php on line 140
I installed ZfcBase and ZfcUser in exactly the same way and location and ZfcBase loads correctly.
The relevant code in ModuleManager.php is:
/**
* Load a specific module by name.
*
* @param string $moduleName
* @throws Exception\RuntimeException
* @triggers loadModule.resolve
* @triggers loadModule
* @return mixed Module's Module class
*/
public function loadModule($moduleName)
{
if (isset($this->loadedModules[$moduleName])) {
return $this->loadedModules[$moduleName];
}
$event = ($this->loadFinished === false) ? clone $this->getEvent() : $this->getEvent();
$event->setModuleName($moduleName);
$this->loadFinished = false;
$result = $this->getEventManager()->trigger(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, $this, $event, function ($r) {
return (is_object($r));
});
$module = $result->last();
if (!is_object($module)) {
throw new Exception\RuntimeException(sprintf(
'Module (%s) could not be initialized.',
$moduleName
));
}
How would I be able to debug this issue?
As suggested by Sam in the comments above, I installed with Composer and ZfcUser works fine. No need to even load ZfcBase explicitly. It was probably Doctrine or other dependency that I missed installing manually. I initially resisted to using Composer because it should be used on a per project basis. But now I use it for several projects where I install to a common vendor directory and all projects share the same index.php, ini_autoload.php and Composer autoload.php file.