0

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 

2 Answers 2

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.

3
  • U can check your apache logs(access or error) for other issues. Commented Jun 24, 2014 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? Commented Jun 24, 2014 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. Commented Jun 25, 2014 at 15:14
1

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.