简体   繁体   English

PHP ZF2安装-ZendSkeletonApplication引发致命错误RuntimeException

[英]PHP ZF2 Installation - ZendSkeletonApplication is throwing Fatal Error RuntimeException

I'm trying to execute ZendSkeletonApplication example for frist time. 我试图在第一时间执行ZendSkeletonApplication示例。 I've acted pursuant this articles from official Zend site: http://framework.zend.com/manual/2.0/en/user-guide/skeleton-application.html 我根据Zend官方网站上的这篇文章采取了行动: http : //framework.zend.com/manual/2.0/en/user-guide/skeleton-application.html

BUT

Why should I download again all dependecies (entire ZF2) via composer if I already downloaded it (ZF2) from Git as zip archive? 如果我已经从Git作为zip存档下载了(ZF2),为什么还要通过作曲家再次下载所有依赖项(整个ZF2)?

Or Does part with php composer doing anything else than downloading entire ZF2? 还是除了下载整个ZF2以外,是否与php composer一起做其他事情? (I've very slow connection so it's problem) (我的连接速度很慢,这是个问题)

I still get this error: 我仍然收到此错误:

Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. 致命错误:消息为“无法加载ZF2”的未捕获异常“ RuntimeException”。 Run php composer.phar install or define a ZF2_PATH environment variable.' 运行php composer.phar install或定义ZF2_PATH环境变量。

My approach is following: (Using Win7, PHP 5.3.5) 我的方法如下:(使用Win7,PHP 5.3.5)

  1. I downloaded entire ZF2 and ZendSkeletonApplication from Git as zip archives. 我从Git下载了整个ZF2和ZendSkeletonApplication作为zip压缩文件。

  2. I Unziped ZF2 to htdocs/ directory. 我将ZF2解压缩到htdocs /目录。 (Now my path to the framework is: xampp/htdocs/ZendFramework-2.3.1/ ) (现在我的框架路径是:xampp / htdocs / ZendFramework-2.3.1 /)

  3. I Unziped ZendSkeletonApplication to htdocs/ (Path location: xampp/htdocs/zf2-tutorial/ ) 我将ZendSkeletonApplication解压缩到htdocs /(路径位置:xampp / htdocs / zf2-tutorial /)

  4. I checked presence of openssl extension. 我检查了openssl扩展名的存在。 It's now enabled in php.ini 现在已在php.ini中启用

  5. I added the Zend Framework's library path to the PHP include_path in php.ini 我将Zend Framework的库路径添加到php.ini中的PHP include_path中

    ( include_path = ".;C:\\xampp\\php\\PEAR; C:\\xampp\\htdocs\\ZendFramework-2.3.1\\library" ) (include_path =“。; C:\\ xampp \\ php \\ PEAR; C:\\ xampp \\ htdocs \\ ZendFramework-2.3.1 \\ library”)

  6. Now, If I type: localhost/zf2-tutorial/public/ , I get FatalError as I mentioned above.. 现在,如果我输入:localhost / zf2-tutorial / public /,则如上所述,我将收到FatalError。

Need I setup some other settings in ZendSkeletonApplication? 我需要在ZendSkeletonApplication中设置其他设置吗? Is it possible to install dependencies via php composer from downloaded zip archive of ZF2? 是否可以通过php composer从ZF2的zip压缩文件中安装依赖项? (No internet connection) ... If so, How can I setup the composer? (没有互联网连接)...如果是,如何设置作曲家?

EDIT: 编辑:

After XAMPP update (php 5.5) I was capable to successfuly access ZFSkeletonAppllication's introductory site (localhost/) after I set ZF2_PATH environment variable. 在更新XAMPP(php 5.5)之后,我可以在设置ZF2_PATH环境变量后成功访问ZFSkeletonAppllication的介绍性站点(localhost /)。

Ok, but unfortunately same FatalError still occur right when I got to the next chapter of ZF2 SkeletonApplication: 好的,但是不幸的是,当我进入ZF2 SkeletonApplication的下一章时,仍然会发生同样的FatalError:

http://framework.zend.com/manual/2.0/en/user-guide/unit-testing.html http://framework.zend.com/manual/2.0/en/user-guide/unit-testing.html

There, PHPUnit framework has been involved to ZF2 application. 在那里,PHPUnit框架已涉及ZF2应用程序。 When I want to run phpunit I get same error as above: 当我想运行phpunit时,出现与上面相同的错误:

Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. 致命错误:消息为“无法加载ZF2”的未捕获异常“ RuntimeException”。 .... ....

I setuped ZF2_PATH environment variable in httpd.conf to: 我在httpd.conf中将ZF2_PATH环境变量设置为:

SetEnv ZF2_PATH c:/xampp/htdocs/ZendFramework-2.3.1/library SetEnv ZF2_PATH c:/xampp/htdocs/ZendFramework-2.3.1/library

I really don't know what I can do now... 我真的不知道该怎么办...

Thanks for help. 感谢帮助。

Chances are include_path not working. 可能include_path无法正常工作。 You need to debug it why. 您需要调试它的原因。 Otherwise you can set ZF2_PATH environment variable as error itself demanded. 否则,您可以将ZF2_PATH environment variable设置为错误本身所要求的。 It is easy way as you may setup framework at one folder while just need to setup ZF2_PATH variable. 这是一种简单的方法,因为您可以在一个文件夹中设置框架,而只需要设置ZF2_PATH变量即可。 For debug, how ZF2 autoloading works, check /init_autloader.php . 对于调试,ZF2自动加载的工作方式,请检查/init_autloader.php。

No need to using composer every time for project setup. 无需每次都使用composer进行项目设置。 I also found it very annoying in composer way to install every time ZF2. 我还发现每次ZF2都以作曲家的方式进行安装非常烦人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM