Search code examples
phpapachesymfony1fastcgi

APC causing an HTTP 500 error code under symfony executed through php5-cgi


I am currently executing PHP through mod_fastcgi (under Apache, of course) and when I enable APC in my php.ini config file, symfony throws me random 500 errors.

When I call app.php or app_dev.php for the first time after an Apache restart, it is working fine, however, any subsequent reloading causes an 500 error.

Here is some logs from Apache,

FastCGI: incomplete headers (0 bytes) received from server "/var/www/bin/php-fastcgi"
Connection reset by peer: [client ******:18656] FastCGI: comm with server "/var/www/bin/php-fastcgi" aborted: read failed
FastCGI: incomplete headers (0 bytes) received from server "/var/www/bin/php-fastcgi"

/var/www/bin/php-fastcgi is my wrapper:

#!/bin/sh

PHP_FCGI_CHILDREN=5
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=500
export PHP_FCGI_MAX_REQUESTS

umask 0022
exec /usr/local/bin/php-cgi -d apc.shm_size=16M

Let me know if you have any clue, any help would be greatly appreciated !

Update: If needed, here is my phpinfo(): https://pobourgeois.com/?phpinfo

Update2: I think my issue is probably in symfony because all of my other websites are loading fine. Do I need any special configuration in Sympfony when using APC ?


Solution

  • I managed to fix this issue myself by compiling APC directly from SVN. (Big thanks to Maerlyn !)

    If anyone runs into the same issue, here are the steps to make everything work together:

    $ svn co http://svn.php.net/repository/pecl/apc/trunk/ apc-trunk
    $ cd apc-trunk/
    $ ./configure --enable-apc --with-php-config=/usr/local/bin/php-config
    $ make
    $ make test (optional)
    $ make install
    

    Also, don't forget to load your new extension in your php.ini file and restart your webserver.

    That's about it !