Zend_Tool:致命错误:无法重新声明类Zend_Loader

时间:2009-10-15 19:16:13

标签: php zend-framework zend-tool

我可以用...创建新项目。

zf create project ProjectName

...但这会创建一个项目而不复制Zend Framework库。所以我将ZF复制到我的项目库中并尝试创建一个控制器......

zf create controller auth

...我收到此消息:

Fatal error: Cannot redeclare class Zend_Loader in /home/andrew/Projects/test/library/Zend/Loader.php on line 31

Call Stack:
    0.0010     110164   1. {main}() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:0
    0.0010     110284   2. zf_main() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:23
    0.0116     685448   3. zf_run() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:36
    0.0116     685568   4. Zend_Tool_Framework_Client_Console::main() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:214
    0.0117     686084   5. Zend_Tool_Framework_Client_Abstract->dispatch() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Console.php:96
    0.4133    4366424   6. Zend_Tool_Framework_Client_Abstract->_handleDispatch() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Abstract.php:227
    0.4134    4366424   7. call_user_func_array() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Abstract.php:308
    0.4134    4366424   8. Zend_Tool_Project_Provider_Controller->create() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Abstract.php:0
    0.4134    4366424   9. Zend_Tool_Project_Provider_Abstract->_loadProfile() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Provider/Controller.php:135
    0.4135    4366652  10. Zend_Tool_Project_Profile->loadFromFile() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Provider/Abstract.php:136
    0.4791    4368888  11. Zend_Tool_Project_Profile_FileParser_Xml->unserialize() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Profile.php:181
    0.4850    4424620  12. Zend_Tool_Project_Profile_FileParser_Xml->_lazyLoadContexts() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Profile/FileParser/Xml.php:110
    0.4886    4434348  13. Zend_Tool_Project_Profile_Resource->initializeContext() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Profile/FileParser/Xml.php:217
    0.4887    4434944  14. Zend_Tool_Project_Context_Zf_BootstrapFile->init() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Profile/Resource.php:226
    0.4899    4437540  15. Zend_Application->__construct() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Context/Zf/BootstrapFile.php:81
    0.5137    4548240  16. Zend_Application->setOptions() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Application.php:92
    0.5179    4696108  17. Zend_Application->setBootstrap() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Application.php:176
    0.5219    4896172  18. Zend_Application_Bootstrap_Bootstrap->__construct() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Application.php:317
    0.5223    4902596  19. Zend_Application_Bootstrap_BootstrapAbstract->hasPluginResource() /home/andrew/Projects/test/library/Zend/Application/Bootstrap/Bootstrap.php:49
    0.5223    4902596  20. Zend_Application_Bootstrap_BootstrapAbstract->getPluginResource() /home/andrew/Projects/test/library/Zend/Application/Bootstrap/BootstrapAbstract.php:314
    0.5223    4902596  21. Zend_Application_Bootstrap_BootstrapAbstract->_loadPluginResource() /home/andrew/Projects/test/library/Zend/Application/Bootstrap/BootstrapAbstract.php:348
    0.5223    4902676  22. Zend_Application_Bootstrap_BootstrapAbstract->getPluginLoader() /home/andrew/Projects/test/library/Zend/Application/Bootstrap/BootstrapAbstract.php:701
    0.5223    4902760  23. Zend_Loader_Autoloader::autoload() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:0
    0.5224    4902760  24. call_user_func() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:130
    0.5224    4902760  25. Zend_Loader_Autoloader->_autoload() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:0
    0.5224    4902896  26. call_user_func() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:474
    0.5224    4902956  27. Zend_Loader::loadClass() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:0
    0.5241    5000704  28. include('/home/andrew/Projects/test/library/Zend/Loader/PluginLoader.php') /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader.php:83
    0.5251    5057592  29. require_once('/home/andrew/Projects/test/library/Zend/Loader.php') /home/andrew/Projects/test/library/Zend/Loader/PluginLoader.php:27

我的设置有什么问题?我怎样才能让Zend_Tool像它应该工作一样工作?

1 个答案:

答案 0 :(得分:4)

在配置文件(application.ini)中用分号注释掉这一行:

;includePaths.library = APPLICATION_PATH "/../library"

这将阻止Zend_Loader被包含两次。