我遇到了一个非常奇怪的问题。我在本地机器上安装了一个新的Linux Mint 17,通过Ondrej Sury的PPA获得了Apache 2和PHP 5.6。我已经从GitHub将Symfony 2项目克隆到我的系统中。
在设置项目(通过composer安装供应商,授予缓存和日志的读/写权限等)后,我在浏览器中运行localhost/diva/web/config.php
,以确保我的系统可以运行。它运行得很好,给我开了绿灯。当试图查看localhost/diva/web/app_dev.php/
的主页时,它给了我一个"连接已重置"错误。很奇怪。CCD_ 3产生了相同的产物。
在查看服务器日志时,我看到了一系列的分段错误,大致如下:
〔周四10月30日18:15:10.291111 2014〕〔核心:通知〕〔pid 1557〕AH00052:子pid 2974退出信号分段故障(11)
为了便于使用,我已经将文档根从原来的(我相信…已经有一段时间了)/var/public/html
移动到了/home/kevin/www
。我做了以下修改:
/etc/apache2/可用站点/00-default.conf:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /home/kevin/www
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
以及在/etc/apache2/apache2.conf:中
<Directory /home/kevin/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
/etc/主机只需:
127.0.0.1 localhost
127.0.1.1 Shevat
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
当谈到建立Apache时,我是个新手。我已经成功地在Apache和Mint的旧版本中移动了我的文档根,但这是第一次发生这样的事情。我不知道我的配置更改是否出了问题。
而且,非常清楚的是,当通过浏览器访问其他PHP文件时,它们可以正常工作。我可以在~/www/*
中的各种嵌套目录深度访问我自己的测试文件,甚至Symfony的config.php
也能按预期工作。只有当我试图访问这两个特定的Symfony文件——app_dev.php
和app.php
时,问题才会出现。
更奇怪的是,这个问题在两台计算机上仍然存在。它发生在我的桌面和我的Surface Pro 3上。它们使用相同的基本VirtualBox环境,但已单独安装。它们不是克隆环境。
在这一点上我不确定该去哪里。
尝试
php -S localhost:8000
作为一个服务器,对我来说,它工作得很好
通过回滚到默认情况下Linux Mint可用的Apache和PHP版本(Apache 2.4.7和PHP 5.4.8)来解决。