无法在ZF2 Skeleton Application中安装ZfcUser / ZfcBase

时间:2013-03-31 21:37:01

标签: zend-framework2 zfcuser

我无法将ZfcUser / ZfcBase模块安装到ZF2 Skeleton应用程序中。 (Ubuntu 12.10服务器,Apache,PHP5.4.6)

1)下载并解压缩ZF2骨架应用程序

2)下载ZF2库并将其解压缩到/ vendor / ZF2

此时,骨架应用程序正常工作。

3)下载并将ZfcBase和ZfcUser解压缩到/ vendor /(例如,这样我有/vendor/ZfcXxxx/Module.php)

4)编辑config / application.config.php以包含两个新模块

<?php
return array(
    // This should be an array of module namespaces used in the application.
    'modules' => array(
        'Application',
        'ZfcBase',
        'ZfcUser',
    ),

我现在得到了

Fatal error:  Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (ZfcBase) could not be initialized.' in /home/ubuntu/zf2-skel/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php:144
Stack trace:
#0 /home/ubuntu/zf2-skel/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php(85): Zend\ModuleManager\ModuleManager->loadModule('ZfcBase')
#1 [internal function]: Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#2 /home/ubuntu/zf2-skel/vendor/ZF2/library/Zend/EventManager/EventManager.php(464): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
#3 /home/ubuntu/zf2-skel/vendor/ZF2/library/Zend/EventManager/EventManager.php(208): Zend\EventManager\EventManager->triggerListeners('loadModules', Object(Zend\ModuleManager\ModuleEvent), NULL)
#4 /home/ubuntu/zf2-skel/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php(104): Zend\EventManager\EventManager->trigger('loadModules', Object(Zend\ModuleManager\ModuleManager), Object(Zend\ModuleMan in /home/ubuntu/zf2-skel/vendor/ZF2/library/Zend/ModuleManager/ModuleManager.php on line 144

据推测,我错过了一些自动加载配置...

2 个答案:

答案 0 :(得分:0)

使用composer.phar非常有用。

php composer.phar self-update
php composer.phar install

无论如何检查你的“autoload_classmap.php”并验证添加ZfcBase。

答案 1 :(得分:0)

我没有使用作曲家(出于各种原因)。这个缺少配置告诉应用程序加载模块的autoload_classmap.php文件只是这个。

Zend\Loader\AutoloaderFactory::factory([
    'Zend\Loader\StandardAutoloader' => [
        'autoregister_zf' => true
    ],
    'Zend\Loader\ClassMapAutoloader' => [
        __DIR__ . '/../vendor/ZfcBase/autoload_classmap.php',
        __DIR__ . '/../vendor/ZfcUser/autoload_classmap.php',
    ],
]);
相关问题