【问题标题】:httpd wont start with added lines for phphttpd 不会从添加的 php 行开始
【发布时间】:2014-04-10 11:27:03
【问题描述】:

我今天在 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:事件 线程:是(固定线程数) 分叉:是(可变进程计数)

我还需要用于 owncloud 和其他 php 项目的 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 没有帮助。我该如何解决这个问题?

【问题讨论】:

    标签: php apache httpd.conf archlinux


    【解决方案1】:

    要在 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 重启后,在我的树莓派上。

    apache 2.4.7 升级:

    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.
    

    【讨论】:

      【解决方案2】:

      切换到 prefork MPM(在 2.4 中,您可以仅使用 LoadModule 进行更改)或将您的 mod_php 切换为使用许多基于 fastcgi 的选项之一(php-fpm + mod_proxy_fcgi 是一种流行的选项)。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-04-29
      • 1970-01-01
      • 1970-01-01
      • 2016-06-15
      • 1970-01-01
      • 2012-07-12
      • 2014-02-13
      相关资源
      最近更新 更多