Before I waste too much more time searching around for this, is it possible to run virtualmin's apache with mpm-worker?
Yeah, I believe mpm-worker works well with CGI and FCGID.
I've heard some stories about it not working well with things like mod_php.
If you have your sites set to use CGI and/or FCGID, you should be in good shape!
All sites are running with FCGID.
So all I will need to do is uncomment this line:
Am I correct in thinking that I would then need to manually recompile php for this to work?
I'm not familiar with the process of moving from prefork to worker mode on CentOS.
However, I don't believe such a switch should require you to make any changes to PHP if mod_php isn't in use.
In theory, it should just be a matter of reconfiguring Apache to use worker mode instead of prefork -- and once you do that, it should work without needing to reconfigure or recompile anything.
Since you aren't using the PHP Apache module (mod_php), PHP shouldn't care how it's being called by Apache... it's just a command line program that Apache calls.
I've got a test Virtualmin GPL 3.79 system set up and I have uncommented the line in /etc/sysconfig/httpd with apache stopped, but when I start it again I get:
Starting httpd: [Tue Jul 20 16:39:22 2010] [crit] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.Pre-configuration failed[FAILED]
The php version I am using is from the vmbleed repo, php 5.2.11-1.el5.vmbleed
Perhaps I'm missing something somewhere?
It sounds like, although you're not using mod_php, it's still being loaded into Apache.
You may need to remove mod_php from your Apache config.
I don't see mod_php in the apache config.
The only line is
LoadModule php5_module modules/libphp5.so
Yup, that's the mod_php module.
So long as nothing in any of your sites or the Apache config is using any mod_php functionality, you should be able to simply comment that line out and restart Apache.
That has worked, certianly in terms of php not using mod_php, however when I type
Should I not expect to see
What does your process list look like? If you run "ps auxw | grep http", what do you see?
ps auxw | grep httproot 30046 0.0 0.9 12808 5044 ? Ss 10:01 0:00 /usr/sbin/httpd.worker
So it looks like worker.c is active.
Thanks again for your insight and info into this!
Yup, that looks good!
I believe what's happening there is that while Apache is running "httpd.worker", the command you were running on the command line is "/usr/sbin/httpd -l", rather than "/usr/sbin/httpd.worker -l".
That does appear to be working well though.
Be sure to let us know any thoughts you have on the performance differences between the two, I'd be curious to hear how that's working out for you.
Yep, hit the nail on it's head:
/usr/sbin/httpd.worker -lCompiled in modules: core.c worker.c http_core.c mod_so.c
The reason I'm trying this is because I have an 4 core server (8 threads), and am interested in seeing what difference this makes to performance.
It's actually so easy to switch between the prefork and worker that I should be able to get some performance info.
Eric-if it were possible for virtualmin users to contact each other somehow on these forums without publicly sending out stuff I would, but I think that this "centtavirla" person who posted here may be another automatic spam user. I've never heard of a centtavirla before, anyhow. Thanks!
That is indeed spam... I've blocked the user and removed their post.
There unfortunately isn't a private message option... though I usually do remove spam once I see it, I just wasn't around most of the weekend :-)
Thanks for the heads up though!
Centos 6 / Plesk 11
I uncomment Line
and get this error in Plesk on starting httpd (Apache)
Cannot start/stop/restart service: Starting httpd: httpd.worker: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Syntax error on line 9 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5-zts.so into server: /etc/httpd/modules/libphp5-zts.so: cannot open shared object file: No such file or directory
so i install - libphp5-zts.so with # yum install php-zts
after this no errors on start of Apache
but # httpd -V shows "Server MPM: Prefork"
# yum install php-zts
# httpd -VServer version: Apache/2.2.15 (Unix)Server built: Feb 22 2013 11:19:58Server's Module Magic Number: 20051115:25Server loaded: APR 1.3.9, APR-Util 1.3.9Compiled using: APR 1.3.9, APR-Util 1.3.9Architecture: 64-bitServer 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="run/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"
m I still running prefork ???
this Order # ps auxw | grep http shows
# ps auxw | grep http
# ps auxw | grep httproot 9783 0.0 0.7 236700 16552 ? Ss 19:05 0:00 /usr/sbin/httpd.workerapache 9788 0.0 0.2 230660 5144 ? S 19:05 0:00 /usr/sbin/httpd.workerapache 9789 0.0 1.3 2226944 27368 ? Sl 19:05 0:00 /usr/sbin/httpd.workerroot 10051 0.0 0.0 103240 832 pts/0 S+ 19:21 0:00 grep http
What you're seeing when running "httpd -V" is just the default.
The config file you changed, /etc/sysconfig/httpd, is what changes that default when the init script is run.
So it looks like you did everything correctly.
What you're seeing in your process list is correct -- that the httpd.worker process means you're using the threaded "worker" mode, and not the pre-fork mode.