Apache环境变量错误(Ubuntu)

4
我的操作系统是Ubuntu 12.04,我已经单独安装了Apache、Php和Mysql。以前从来没有出现过问题,但在一次Ubuntu更新之后,当我尝试访问Web服务器上的php文件时,总是会出现“404 Not Found”错误。
当我在控制台上输入“apache2 -S”时,我得到下面的输出:
[Sat Feb 22 16:15:16.983766 2014] [core:warn] [pid 4475] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Sat Feb 22 16:15:16.983871 2014] [core:warn] [pid 4475] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Sat Feb 22 16:15:16.983914 2014] [core:warn] [pid 4475] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Sat Feb 22 16:15:16.983936 2014] [core:warn] [pid 4475] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Sat Feb 22 16:15:16.983966 2014] [core:warn] [pid 4475] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sat Feb 22 16:15:16.987930 2014] [core:warn] [pid 4475:tid 139974428579648] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
[Sat Feb 22 16:15:16.988259 2014] [core:warn] [pid 4475:tid 139974428579648] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sat Feb 22 16:15:16.988433 2014] [core:warn] [pid 4475:tid 139974428579648] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sat Feb 22 16:15:16.988456 2014] [core:warn] [pid 4475:tid 139974428579648] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 75 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR} 

有谁能帮我吗?

3个回答

5

从阅读这个bug页面可以看出,所有这些变量都需要在运行apache2之前进行导出,而且这些变量都与环境有关。显然,在像“service apache2 start”这样的服务中运行它时,它们会自动从 /etc/apache2/envvars 加载。另一种选择是使用apache2ctl启动。


0
我在Ubuntu Server 14.04上通过Apache 2.4本地运行Bugzilla时遇到了非常类似的问题。 运行命令sudo /etc/init.d/apache2 graceful使页面加载,而此前Chrome告诉我没有收到任何数据。 我希望比我更有知识的人能解释为什么这样有效,但是service apache2 startapache2ctl则不行。

0

这也是我输入apache2 -S时得到的结果,但一切都工作正常。 如果您查看apache手册页面-它只涉及某些配置解析数据。您的PHP代码有任何错误吗?查看apache日志文件-它们存储在 var / log / apache2 目录下。


我之前不知道这个问题,谢谢你提醒。我的日志显示:AH00094: 命令行:'/usr/sbin/apache2'... 我真的不知道问题出在哪里,我已经苦恼了两周了。没有 PHP 错误,只有 404 错误。在 Ubuntu 更新之前一切都正常。 - leonardo_palma
我建议您删除所有的堆栈,然后重新安装。这里有一个好的指南http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-13.04-lamp - Miroslav Trninic

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接