![设置工作者 MPM 时出现问题](https://linux22.com/image/592193/%E8%AE%BE%E7%BD%AE%E5%B7%A5%E4%BD%9C%E8%80%85%20MPM%20%E6%97%B6%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
无法使 MPM Worker 工作..
我已经安装了该php-zts
软件包,取消了注释#HTTPD=/usr/sbin/httpd.worker
并/etc/sysconfig/httpd
重新启动了 httpd 服务。
httpd 打印输出:
[root@web06 ~]# httpd -V
Server version: Apache/2.2.3
Server built: Sep 3 2009 17:38:51
Server's Module Magic Number: 20051115:3
Server loaded: APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture: 32-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
阿帕奇:
[root@web06 ~]# apachectl -v
Server version: Apache/2.2.3
Server built: Sep 3 2009 17:41:45
[root@web06 ~]# apachectl -l
Compiled in modules:
core.c
worker.c
http_core.c
mod_so.c
服务器的详细信息:
Linux web 2.6.18-164.15.1.el5PAE #1 SMP Wed Mar 17 12:14:29 EDT 2010 i686 i686 i386 GNU/Linux
为什么 https 在 prefork 模式下仍然可以工作?
我感觉我错过了一些非常基本的东西......
谢谢!
编辑1
[root@web06 ~]# ps -ef | grep httpd
apache 4366 14700 0 05:44 ? 00:00:34 /usr/sbin/httpd
apache 9239 14700 0 06:07 ? 00:00:22 /usr/sbin/httpd
apache 9260 14700 0 06:07 ? 00:00:23 /usr/sbin/httpd
apache 9271 14700 0 06:07 ? 00:00:23 /usr/sbin/httpd
apache 9288 14700 0 06:07 ? 00:00:22 /usr/sbin/httpd
apache 9337 14700 0 06:07 ? 00:00:23 /usr/sbin/httpd
root 14700 1 0 Aug08 ? 00:00:00 /usr/sbin/httpd
apache 14702 14700 0 Aug08 ? 00:00:00 /usr/sbin/httpd
apache 22445 14700 0 06:57 ? 00:00:04 /usr/sbin/httpd
apache 22480 14700 0 06:57 ? 00:00:04 /usr/sbin/httpd
apache 27910 14700 0 07:10 ? 00:00:00 /usr/sbin/httpd
apache 27917 14700 0 07:10 ? 00:00:00 /usr/sbin/httpd
root 27948 9898 0 07:11 pts/2 00:00:00 grep httpd
编辑2
[root@web06 ~]# ls -l /usr/sbin/httpd*
-rwxr-xr-x 1 root root 315284 Sep 3 2009 /usr/sbin/httpd
-rwxr-xr-x 1 root root 327708 Sep 3 2009 /usr/sbin/httpd.event
-rwxr-xr-x 1 root root 327708 Sep 3 2009 /usr/sbin/httpd.worker
[root@web06 ~]# cat /var/log/httpd/error_log
[Thu Aug 09 07:26:14 2012] [notice] SELinux policy enabled; httpd running as context root:system_r:httpd_t
[Thu Aug 09 07:26:14 2012] [notice] Digest: generating secret for digest authentication ...
[Thu Aug 09 07:26:14 2012] [notice] Digest: done
[Thu Aug 09 07:26:14 2012] [notice] mod_python: Creating 4 session mutexes based on 6 max processes and 25 max threads.
[Thu Aug 09 07:26:14 2012] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
编辑3
[root@web06 conf]# grep '/etc/sysconfig/httpd' /etc/init.d/httpd
# config: /etc/sysconfig/httpd
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
编辑4
输出sh -x /etc/init.d/httpd start > /tmp/apache.debug 2>&1
编辑5
运行@quanta 的命令后:
[root@web06 ~]# ps -ef | grep httpd
root 16303 1 0 08:29 ? 00:00:00 /usr/sbin/httpd.worker
apache 16305 16303 2 08:29 ? 00:00:37 /usr/sbin/httpd.worker
apache 16307 16303 2 08:29 ? 00:00:35 /usr/sbin/httpd.worker
root 20415 20381 0 08:56 pts/1 00:00:00 grep httpd
答案1
不知道为什么第一次检查ps -ef | grep httpd
仍然显示/usr/sbin/httpd
,但是因为我在调试中看到以下内容:
+ /bin/bash -c 'ulimit -S -c 0 >/dev/null 2>&1 ; /usr/sbin/httpd.worker'
...
+ success 'httpd.worker startup'
我很确定你的 Apache 正在工作模式下运行,第二次检查证明:
[root@web06 ~]# ps -ef | grep [h]ttpd
root 16303 1 0 08:29 ? 00:00:00 /usr/sbin/httpd.worker
apache 16305 16303 2 08:29 ? 00:00:37 /usr/sbin/httpd.worker
apache 16307 16303 2 08:29 ? 00:00:35 /usr/sbin/httpd.worker
不用来httpd -V
检查 Apache 运行的模式,因为:
# which httpd
/usr/sbin/httpd
改用apachectl -V
(大写):
Server version: Apache/2.2.3
Server built: Oct 20 2011 17:03:44
Server's Module Magic Number: 20051115:3
Server loaded: APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture: 64-bit
Server MPM: Worker
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/worker"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
或者/server-info
:
$ lynx -dump http://yourdomain.com/server-info | grep -i mpm
MPM Name: Worker
MPM Information: Max Daemons: 1 Threaded: yes Forked: yes
Server Built With: -D APACHE_MPM_DIR="server/mpm/prefork" -D
AcceptMutex - Valid accept mutexes for this platform and MPM