I'm having trouble with APC working correctly. I've installed the following packages on my CentOS 5.7 VPS:
- httpd.i386 - 2.2.3-53.el5.centos.3
- php.i386 - 5.2.10-1.el5.centos
- mod_fastcgi.i386 - 2.4.6-1.el5.rf
My /etc/httpd/conf.d/fastcgi.conf file looks like this:
<IfDefine FASTCGI>
LoadModule fastcgi_module modules/mod_fastcgi.so
FastCgiConfig -idle-timeout 20 -maxClassProcesses 1
FastCgiWrapper On
<Location "/cgi-bin/php-fastcgi">
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
Options ExecCGI
SetHandler fastcgi-script
</Location>
AddHandler php5-fcgi .php
AddType application/x-httpd-php .php
Action php5-fcgi /cgi-bin/php-fastcgi
</IfDefine>
Virtualhost for one of the websites looks like this:
<VirtualHost XXX.XXX.XXX.XXX:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /home/user/public_html
ErrorLog logs/example.com-error_log
CustomLog logs/example.com-access_log common
SuexecUserGroup user user
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory "/home/user/public_html">
Options +ExecCGI
AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php.fcgi
Order allow,deny
Allow from all
</Directory>
<Directory "/home/user/public_html/cgi-bin">
AllowOverride None
Options +FollowSymLinks +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And my fastcgi script in /var/www/cgi-bin/php.fcgi looks like this:
#!/bin/sh
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_MAX_REQUESTS
umask 0022
exec /usr/bin/php-cgi
APC is configured only with the following directives (everything that is not mentioned, of course, inherits the default values):
extension=apc.so
apc.enabled=1
apc.shm_size=32M
apc.ttl=0
apc.file_update_protection=2
apc.stat=1
apc.rfc1867=1
apc.mmap_file_mask=/tmp/apc.XXXXXX
My PHP aplications work without any problems, but APC doesn't do the cacheing. For example, if I access the apc.php file to see the cache stats I can see that APC uptime is on every page refresh only 1 second.
I suppose that cause of this problem would be FastCGI spawning more than one php-cgi process, but there is FastCgiConfig -idle-timeout 20 -maxClassProcesses 1 in fastcgi.conf which should limit spawning to only one process. :-/
Am I missing something or did I maybe misconfigured something?
Edit: I forgot to mention, Apache is running as worker MPM.
Syntax error on line 23 of /etc/httpd/conf.d/fastcgi.conf: FastCgiWrapper: "/usr/sbin/suexec" execute access for server (uid -1, gid -1) failed: execute not allowed– wolfyer Oct 23 '11 at 16:21