Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 无法启动Zend2骨架应用程序_Php_Xampp_Zend Framework2 - Fatal编程技术网

Php 无法启动Zend2骨架应用程序

Php 无法启动Zend2骨架应用程序,php,xampp,zend-framework2,Php,Xampp,Zend Framework2,我在windows XP上有一个xampp服务器: Apache 2.4.3 PHP 5.4.7 我试着开始学习Zend2 我下载了skeleton应用程序: 并从cmd运行: php composer.phar self-update php composer.phar install (并不是说我必须给出一个指向php的完整链接,比如C:\xxx\php.exe——我不知道为什么,我的环境变量中有php)。一切正常-没有错误 我将此代码添加到httpd-vhosts.conf中: <

我在windows XP上有一个xampp服务器: Apache 2.4.3 PHP 5.4.7

我试着开始学习Zend2

我下载了skeleton应用程序: 并从cmd运行:

php composer.phar self-update
php composer.phar install
(并不是说我必须给出一个指向php的完整链接,比如C:\xxx\php.exe——我不知道为什么,我的环境变量中有php)。一切正常-没有错误

我将此代码添加到httpd-vhosts.conf中:

<VirtualHost *:80>
    ServerName zf2-tutorial.localhost
    DocumentRoot /zf2-tutorial/public
    SetEnv APPLICATION_ENV "development"
    <Directory /zf2-tutorial/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
当我跑的时候

http://zf2-tutorial.localhost 
在浏览器中,我得到“权限被拒绝”

当我尝试

http://localhost/zf2-tutorial/public/ 
我得到很长的php错误

Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\InvalidArgumentException' with message 'Provided abstract factory must be the class name of an abstract factory or an instance of an AbstractFactoryInterface.' in C:\xampp\htdocs\zf2-tutorial\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:302 ...........
我觉得serwer出了什么问题,因为我得到了“拒绝许可”。 我做错了什么?Thx提前

大家好。我的最终配置:

<VirtualHost *:80>
    ServerName zf2-tutorial.localhost
    DocumentRoot C:/xampp/htdocs/zf2-tutorial/public
    SetEnv APPLICATION_ENV "development"
    <Directory C:/xampp/htdocs/zf2-tutorial/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

127.0.0.1               zf2-tutorial.localhost

ServerName zf2-tutorial.localhost
DocumentRoot C:/xampp/htdocs/zf2 tutorial/public
SetEnv应用程序_ENV“开发”
DirectoryIndex.php
允许超越所有
命令允许,拒绝
通融
127.0.0.1 zf2-tutorial.localhost

工作正常:

您的主机文件不正确。而不是:

127.0.0.1               zf2-tutorial.localhost localhost
删除最后一个“localhost”,以便获得:

127.0.0.1               zf2-tutorial.localhost
编辑:
我刚才注意到的另一件事是DocumentRoot:这应该是指向文档根的完全限定路径:即C:/www/zf tutorial/public。请注意,应该对目录分隔符使用正斜杠。在目录配置中使用相同的路径,以确保允许访问该目录。

您似乎在使用Windows,因此您的vhost配置应包含指向项目的类似Windows的路径。您确定在%path%中有指向php\bin的有效路径吗

> echo %PATH%
我在Windows7上使用XAMPP。 以下是我的vhost配置:

<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host2.localhost
    DocumentRoot "C:/xampp/projects/zf2-tutorial/public"
    ServerName zf2.tutorial
    ##ServerAlias www.dummy-host2.localhost
    SetEnv APPLICATION_ENV "development"
    <Directory C:/xampp/projects/zf2-tutorial/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
    ErrorLog "logs/zf2.tutorial-error.log"
    CustomLog "logs/zf2.tutorial-access.log" combined
</VirtualHost>

##服务器管理员postmaster@dummy-host2.localhost
DocumentRoot“C:/xampp/projects/zf2 tutorial/public”
ServerName zf2.0教程
##ServerAlias www.dummy-host2.localhost
SetEnv应用程序_ENV“开发”
DirectoryIndex.php
允许超越所有
命令允许,拒绝
通融
要求所有授权
ErrorLog“logs/zf2.tutorial error.log”
CustomLog“logs/zf2.tutorial access.log”组合
这一点很重要(可能在您的情况下也是如此):


# ...
要求所有授权

谢谢您的回复。不幸的是,它不起作用。现在我在两个
http://zf2-tutorial.localhost
http://localhost/zf2-tutorial/public/
@Ruben我也有同样的错误。你能帮我一下吗请看这里:Thanx。这解决了启动skeleton应用程序的问题,但我只能在
http://localhost/zf2-tutorial/public/
知道为什么vhost不适用于
http://zf2-tutorial.localhost
我也面临同样的问题。但这似乎是一个bug,在zf2的github问题跟踪程序(weierophinney的评论)上发现了这个bug。恐怕我们只能等待修复。我有相同的错误帮助plz
<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host2.localhost
    DocumentRoot "C:/xampp/projects/zf2-tutorial/public"
    ServerName zf2.tutorial
    ##ServerAlias www.dummy-host2.localhost
    SetEnv APPLICATION_ENV "development"
    <Directory C:/xampp/projects/zf2-tutorial/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
    ErrorLog "logs/zf2.tutorial-error.log"
    CustomLog "logs/zf2.tutorial-access.log" combined
</VirtualHost>
    <Directory C:/xampp/projects/zf2-tutorial/public>
        # ...
        Require all granted
    </Directory>