Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having some problem with APC working properly. File cache always shows Hits = 1 and misses keep increasing, but at the same time, the cached file entries show some numbers in hundreds over some time. User cache entries shows to be working normally it seems. But almost twice a day i keep getting Internal server error and then have to restart php-fpm. I hv allocated 1024M memory and some other regular config stuff. If you have more idea, can i have your email ID to discuss this and send you more details about it.

The APC config is as following. I have tried Non-zero ttls and other options. Also, in the FastCGI config - I have tried settingPHP_FCGI_CHILDREN as '0' and other values. I have set PHP_FCGI_MAX_REQUESTS (12000) more than FcgidMaxRequestsPerProcess value (8000), as i found in this article, http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html

But still internal server error keeps coming almost twice a day and I have to restart PHP-FPM

APC config as below:

apc.cache_by_default    1
apc.canonicalize    1
apc.coredump_unmap  0
apc.enable_cli  0
apc.enabled 1
apc.file_md5    0
apc.file_update_protection  2
apc.filters 
apc.gc_ttl  3600
apc.include_once_override   1
apc.lazy_classes    00
apc.lazy_functions  0
apc.max_file_size   4M
apc.mmap_file_mask  /tmp/apc.mXJeFR
apc.num_files_hint  10000
apc.preload_path    
apc.report_autofilter   0
apc.rfc1867 0
apc.rfc1867_freq    0
apc.rfc1867_name    APC_UPLOAD_PROGRESS
apc.rfc1867_prefix  upload_
apc.rfc1867_ttl 3600
apc.serializer  default
apc.shm_segments    1
apc.shm_size    1024M
apc.shm_strings_buffer  4M
apc.slam_defense    1
apc.stat    1
apc.stat_ctime  0
apc.ttl 0
apc.use_request_time    1
apc.user_entries_hint   4096
apc.user_ttl    0
apc.write_lock  1

PHP.FastCGI config is as following:

#!/bin/bash
PHPRC="/etc/php.ini"
PHP_FCGI_CHILDREN=16
PHP_FCGI_MAX_REQUESTS=12000
export PHPRC
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec /usr/bin/php-cgi

Warm rgds Satya

share|improve this question

2 Answers 2

I think clearing cache is an alternative for this issue . Either restart your apache service or add something like apc.php file and set a cron to clear it after specific interval in accordance to your needs.

OR Alternatively

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

share|improve this answer
    
U can check your apache logs(access or error) for other issues. –  Innovator Jun 24 at 5:42
    
I get these errors in the error log. [Tue Jun 24 17:12:31 2014] [error][client 66.249.79.198](104)Connection reset by peer: FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi" aborted: read failed [Tue Jun 24 17:12:31 2014] [error][client 66.249.79.198] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php5-fcgi" Also at this time the Hits count starts increasing and a couple of cached PHP files start showing hits increasing. I am on a virtual server and my portal files are located at: /var/www/html/ananyafashions.com, so should the APC tmp direc be changed path? –  Satyadeo Kumar Jun 24 at 15:31
    
Are you able to understand why does the memory pie shows all used up in red, when actually there is lots of Free memory available? At the same time fragmentation always remains low in the range of 0 to 5 % or so. –  Satyadeo Kumar Jun 25 at 15:14
up vote 0 down vote accepted

Just for the benefit of the community - this is something unique which was causing havoc for me and I didn't find any instance of this situation asked or answered before in my extensive seach on this issue.

The Issue for getting frequent Internal server errors was that - I had PHP 5.4.27 and Zend Opcache was installed on my server before I migrated my new ecommerce site which used APC cache. This was causing a conflict somewhere and trhowing internal server error.

After removind Zend Opcache, Another factor was apc.include_once_override was set to '1'. It caused page distortions, I had read about this somewhere so was able to immediately pin point and et to '0'.

Now it works fine like charm !!! and I am so relieved after a month's battle.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.