APC cache, Centos 6.5 - php-pecl-apc-3.1.9 - too old throwing segfaults


I am pretty sure many people use APC for PHP opcode caching as it proved to increase the overall performance greatly. Even more, on CentOS the installation is extremely easy.

Here is what we use on on setups and I guess its pretty standard for many of you:

  • CentOS 6.5 (regularly updated) + Virtualmin
  • Apache is using mpm_worker (so easy on CentOS)
  • mod_php is completely disabled, all sites use mod_fcgid mode
  • APC is installed (php-pecl-apc-3.1.9-2.el6 from the base repo)

Fine tuning the settings for mpm_worker, mod_fcgid and apc pretty high performance and scalability can be achieved (I can post our tested and proved configurations later).

There are two bottlenecks in this setup though - mod_fcgid and APC. More on mod_fcgid in a different topic (I already posted a problem with it few months ago - apparently I have found a solution). This topic though is on APC.

Apparently after the latest PHP update in CentOS 6.5 (php 5.3.3-27.el6_5) APC started throwing segfault errors. I have errors like this in apache error log:

[error] mod_fcgid: process /home/someuser/fcgi-bin/php5.fcgi(11303) exit(communication error), get unexpected signal 11

which are basically a segfaults by the php_cgi process. This is what you get in the kernel messages log:

php-cgi[11303]: segfault at 10 ip 000000000058b0cf sp 00007fff5a610990 error 4 in php-cgi[400000+2c3000]

Further debugging shows the problem is the APC cache. I never get those with the previous php package from CentOS base. An option was to downgrade the php package, but I don’t like that so I decided to try to update APC instead. The APC package available with the CentOS base is 3.1.9, which is also the latest “stable” version published at the APC website. Ver 3.1.9 is almost 3 years old (released at 2011-05-14). The latest beta there is 3.1.13. After some reading a lot of people report that upgrading to 3.1.13 removes most segfaults (if you check the changelog these are the actual differences - fixes and patches for errors). I compiled APC 3.1.13 from the official trunk and installed it. So far I am testing it for a week and no errors anymore.


  • Do you get these segfault errors too?
  • Did you try upgrading APC to 3.1.13? How was your testing?
  • If it proves to be stable (release date 2012-09-03 - no errors reported with php 5.3.3 so far - there are issues with php 5.4) should we provide and rpm for it at the Virtualmin repo? Might be Centos 6.5 bleeding edge repo? The “beta” status can stay forever there and CentOS are not likely to provide a package for a “beta” APC.

What are your thoughts?


I’d be interested to hear the experiences of others as well… if that’s a common issue, that might be something to post as a bug to the RHEL/CentOS folks. But I’ll definitely mention it to Joe and Jamie that you’ve experienced some problems with APC, and the results of your testing, and see what they think.