Centos – Enabling APC causes internal server error

centosfastcgiPHP

After installing and enabling APC 3.1.9 (Alternate PHP Cache), using pecl, i ran into an internal server error. I checked my error logs, and this is what shows up.

Error Logs:

PHP Fatal error:  PHP Startup: apc_mmap: mkstemp on /tmp/apc.efdb4d failed: in Unknown on line 0
[Wed Jul 06 23:47:41 2011] [error] mod_fcgid: process /var/www/cgi-bin/cgi_wrapper/cgi_wrapper(22397) exit(communication error), get unexpected signal 11

Instead of adding the APC extension to my php.ini file, i created an apc.ini file in /etc/php.d/, here's my current APC configuration

apc.ini configuration:

; /etc/php.d/apc.ini

extension = apc.so

apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 128M
apc.optimization = 0
apc.num_files_hint = 4096
apc.ttl = 7200
apc.user_ttl = 7200
apc.gc_ttl = 0
apc.cache_by_default = 1
apc.filters = ""
apc.mmap_file_mask = "/tmp/apc.XXXXXX"
apc.slam_defense = 0
apc.file_update_protection = 2
apc.enable_cli = 0
apc.max_file_size = 10M
apc.stat = 1
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
;apc.rfc1867 = 0
;apc.rfc1867_prefix = "upload_"
;apc.rfc1867_name = "APC_UPLOAD_PROGRESS"
;apc.rfc1867_freq = 0
apc.localcache = 0
apc.localcache.size = 512
apc.coredump_unmap = 0
apc.stat_ctime = 0

Even after disabling APC, i ran into another error while trying to log in to Plesk CP:

ERROR: Zend_Db_Statement_Exception
SQLSTATE[HY000]: General error: 1 Can't create/write to file '/tmp/#sql_6d7_0.MYI' (Errcode: 13)

I fixed the above problem by restarting my container through Plesk's Power Panel. I think it had to with changing /tmp to exec using mount -o remount,exec /tmp to solve permission errors during the APC installation through pecl. After the installation was done, I returned /tmp back to noexec. The gist of these steps can be found here.

The first error still remains unsolved.

I'm Currently running on:

  • CentOS 5.6
  • PHP 5.3.5
  • FastCGI
  • Installed APC 3.1.9

I'm not sure how to solve this problem. Is it because im using the lastest version of APC? or the apc.ini config? Does it matter where i enabled the apc extension? i.e. /etc/php.ini versus /etc/php.d/apc.ini

How about FastCGI and APC compability issues?

Any help or advice would be greatly appreciated.

Best Answer

Do you have open_dir restrictions in effect? If this is on user account I would set APC's tmp directory relative to users home directory with proper permissions.