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

发布于 2024-08-08 02:48:13 字数 5062 浏览 6 评论 0原文

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

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 像它应该的那样工作?

I am able to create new projects with...

zf create project ProjectName

...but this creates a project without copying the Zend Framework library. So I copy ZF into my project library and try to create a controller...

zf create controller auth

...and I get this message:

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

What is wrong with my setup? How can I get Zend_Tool to work like it's supposed to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

篱下浅笙歌 2024-08-15 02:48:13

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

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

这将防止 Zend_Loader 被包含两次。

In your config file (application.ini) comment out this line with a semicolon:

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

This will prevent Zend_Loader from being included twice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文