Reputation: 756
After installing APC, see the apc.php script, the uptime restart every one or two hours? why? How can I change that?
I set apc.gc_ttl = 0
Upvotes: 1
Views: 1373
Reputation: 6023
I ran into the same issue today, found the solution here: http://www.itofy.com/linux/cpanel/apc-cache-reset-every-2-hours/
You need to go to AccesWHM > Apache Configuration > Piped Log Configuration
and Enable Piped Apache Logs
.
Upvotes: 0
Reputation: 3692
If you use a TTL of 0 APC will clear all cache slots when it runs out of memory. This is what appends every 2 hours.
TTL must never be set to 0
Just read the manual to understand how TTL is used : http://www.php.net/manual/en/apc.configuration.php#ini.apc.ttl
Use apc.php from http://pecl.php.net/get/APC, copy it to your webserver to check memory usage.
You must allow enough memory so APC have 20% free after some hours running. Check this on a regular basis. If you don't have enough memory available, use filters option to prevent rarely accessed files from being cached.
Check my answer there What is causing "Unable to allocate memory for pool" in PHP?
Upvotes: 1
Reputation: 20753
APC caches lives as long as their hosting process, it could be that your apache workers reach their MaxConnectionsPerChild limit and they get killed and respawned clearing the cache with it. This a safety mechanism against leaking processes.
php -b
used)You could try setting the option you are using to it's "doesn't matter" value (usually 0
) and run test the setup with a simple hello world php script, and apachebench ab2 -n 10000 -c 10 http://localhost/hello.php
(tweak the values as needed) to see if the worker pid's are changing or not.
Upvotes: 1