Skip to content

Instantly share code, notes, and snippets.

@cballou
Created March 24, 2012 21:11
Show Gist options
  • Save cballou/2188015 to your computer and use it in GitHub Desktop.
Save cballou/2188015 to your computer and use it in GitHub Desktop.
SWITCHING APACHE FROM PREFORK TO WORKER MPM IN RHEL / CENTOS 5.X / FEDORA 13
yum install libtool httpd-devel apr-devel apr
[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[notice] Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.5 PHP/5.3.2 configured
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.disable
LoadModule php5_module modules/libphp5-zts.so
yum search zts
yum install php-zts mod_fcgid
# The Communication timeout; your new max execution time variable
# The default is 20 seconds if omitted
IPCCommTimeout 60
# Connection timeout: Default value is 3 seconds
IPCConnectTimeout 3
<IfModule mod_fcgid.c>
# Path to directory containing php.ini
DefaultInitEnv PHPRC=/etc/
# Number of PHP children that will be launched.
#DefaultInitEnv PHP_FCGI_CHILDREN 3
# Maximum requests before a process is stopped and a new one is launched.
#DefaultInitEnv PHP_FCGI_MAX_REQUESTS 5000
# Define a new handler "php-fcgi" for ".php" files
AddHandler php-fcgi .php
# Add an action binding the new handler to an alias (see below)
Action php-fcgi /fcgi-bin/phpfcgi
# Define the MIME-Type for ".php" files
AddType application/x-httpd-php .php
# Define alias "/fcgi-bin/" used by the action above.
# Allows you to run a different command by overriding alias in vhosts
Alias /fcgi-bin/ /var/www/cgi-bin/
# Turn on the fcgid-script handler for all files within the alias "/fcgi-bin/"
<Location /fcgi-bin/>
SetHandler fcgid-script
Options +ExecCGI
</Location>
</IfModule>
#HTTPD=/usr/sbin/httpd.worker
# service httpd restart
# apachectl graceful
/etc/init.d/httpd restart
# check log files to ensure a successful restart
# press ctrl+z to get out
tail -f /var/log/httpd/error.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment