首页 > Web开发 > 详细

将apache的prefork改成worker

时间:2016-01-06 19:45:49      阅读:167      评论:0      收藏:0      [点我收藏+]

1. 检测apache正在使用哪个MPM?

XXX@XXX-ThinkPad-Edge-E431:~$ apachectl -V | grep -i mpm
Server MPM:     prefork

 2. 列出可用的MPM模块(确保mpm_worker在列表中)

XXX@XXX-ThinkPad-Edge-E431:~$ ls /etc/apache2/mods-available/mpm*
/etc/apache2/mods-available/mpm_event.conf
/etc/apache2/mods-available/mpm_event.load
/etc/apache2/mods-available/mpm_prefork.conf
/etc/apache2/mods-available/mpm_prefork.load
/etc/apache2/mods-available/mpm_worker.conf
/etc/apache2/mods-available/mpm_worker.load

 

 3. 列出开启的MPM模块(如果mpm_worker没有开启,我们应该开启mpm_worker,禁用mpm_prefork模块)

XXX@XXX-ThinkPad-Edge-E431:~$ ls -l /etc/apache2/mods-enabled/mpm*
lrwxrwxrwx 1 root root 34 10月 29 11:04 /etc/apache2/mods-enabled/mpm_prefork.conf -> ../mods-available/mpm_prefork.conf
lrwxrwxrwx 1 root root 34 10月 29 11:04 /etc/apache2/mods-enabled/mpm_prefork.load -> ../mods-available/mpm_prefork.load

 

 4. 禁用MPM_PREFORK模块

XXX@XXX-ThinkPad-Edge-E431:~$ sudo a2dismod mpm_prefork 
[sudo] password for XXX: 
Module mpm_prefork disabled.
To activate the new configuration, you need to run:
  service apache2 restart

 

5. 开启MPM_WORKER模块

XXX@XXX-ThinkPad-Edge-E431:~$ sudo a2enmod mpm_worker 
Considering conflict mpm_event for mpm_worker:
Considering conflict mpm_prefork for mpm_worker:
Considering conflict mpm_itk for mpm_worker:
Enabling module mpm_worker.
To activate the new configuration, you need to run:
  service apache2 restart

 

6. 重新启动apache服务。

 

XXX@XXX-ThinkPad-Edge-E431:~$ sudo service apache2 restart
 * Restarting web server apache2                                         [fail] 
 * The apache2 configtest failed.
Output of config test was:
[Wed Jan 06 18:05:55.525309 2016] [:crit] [pid 11501:tid 140459254396800] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
AH00013: Pre-configuration failed
Action configtest failed.
The Apache error log may have more information.

 

 重新启动时,会报错误:待解决

7. 检测apache是否运行在MPM_WORKER

XXX@XXX-ThinkPad-Edge-E431:~$ apachectl -V |grep -i mpm
Server MPM:     worker

 

将apache的prefork改成worker

原文:http://www.cnblogs.com/yandufeng/p/5106587.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!