httpd不会开始添加PHP的行

时间:2014-03-07 10:49:31

标签: php apache httpd.conf archlinux

我今天在Arch for ARM上更新了我的httpd和php版本。

现在的版本是:
apachectl -V 服务器版本:Apache / 2.4.7(Unix) 服务器内置:2014年3月6日17:04:51 服务器的模块幻数:20120211:27 服务器已加载:APR 1.5.0,APR-UTIL 1.5.3 编译使用:APR 1.5.0,APR-UTIL 1.5.3 架构:32位 服务器MPM:事件   threaded:yes(固定线程数)     分叉:是(可变过程计数)

我还需要php for owncloud和其他php项目,因为我添加了这些行:

LoadModule php5_module       modules/libphp5.so
AddHandler php5-script php
Include conf/extra/php5_module.conf

到文件/etc/httpd/conf/httpd.conf。

在更新之前,这个配置工作正常,更新后的apache将不再启动,它始终显示错误:

Mar 07 03:43:59 alarm apachectl[1006]: [Fri Mar 07 03:43:59.408232 2014] [:crit] [pid 1008:tid 3070083072] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
Mar 07 03:43:59 alarm apachectl[1006]: AH00013: Pre-configuration failed
Mar 07 03:43:59 alarm systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 07 03:43:59 alarm systemd[1]: Failed to start Apache Web Server.
Mar 07 03:43:59 alarm systemd[1]: Unit httpd.service entered failed state.

删除并重新安装php没有帮助。我该如何解决这个问题?

2 个答案:

答案 0 :(得分:12)

要切换到Apache / 2.4.7上的 prefork MPM (与之前的Apache版本一样),请在/etc/httpd/conf/httpd.conf中执行此操作:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so   
#LoadModule mpm_event_module modules/mod_mpm_event.so

并在httpd重新启动后,在我的覆盆子pi。

2.4.7中的apache升级:

Mar 07 19:33:56 rasperus systemd[1]: Starting Apache Web Server...
Mar 07 19:33:56 rasperus apachectl[23469]: [Fri Mar 07 19:33:56.909344 2014] [:crit] [pid 23471:tid 3069247488] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
Mar 07 19:33:56 rasperus apachectl[23469]: AH00013: Pre-configuration failed
Mar 07 19:33:56 rasperus systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 07 19:33:56 rasperus systemd[1]: Failed to start Apache Web Server.
Mar 07 19:33:56 rasperus systemd[1]: Unit httpd.service entered failed state.

在httpd.conf中修改后:

Mar 07 19:45:11 rasperus systemd[1]: Starting Apache Web Server...
Mar 07 19:45:12 rasperus systemd[1]: PID file /run/httpd/httpd.pid not readable (yet?) after start.
Mar 07 19:45:12 rasperus systemd[1]: Started Apache Web Server.

答案 1 :(得分:3)

切换到prefork MPM(在2.4中,你可以只用LoadModule更改)或者将你的mod_php切换到使用许多基于fastcgi的选项之一(php-fpm + mod_proxy_fcgi是一个很受欢迎的选项)。