Nick
Nick

Reputation: 11384

How do I Disable the Code Cache for PHP 5 (FPM) with Nginx?

When I save changes to a PHP file and then reload, it continues to execute the old version of the script for a minute or so regardless of how many refreshes I do. After 1 minute (or so) it executes the current version.

How do I disable this behaviour so changes occur immediately?

Setup is PHP-FPM with Nginx.

Upvotes: 12

Views: 22698

Answers (4)

Hackerman
Hackerman

Reputation: 21

In my case (localhost dev server, Nginx 1.10.0, PHP 7.0.13, no OPCache, no APC), setting realpath_cache_ttl to 0 and then restarting the PHP-FPM service did a trick. But one has to be careful changing this value on production server.

Upvotes: 2

Blake B.
Blake B.

Reputation: 295

My solution was in the Zend OPCache configuration rather than APC.

I installed the vanilla version of WNMP (PHP 5.5.11) on my Windows 8.1 box and discovered in my php.ini file's [opcache] section that the Zend OPCache was enabled and only checking file changes once every 60 seconds (opcache.revalidate_freq=60). Look for that config directive and set it to 0 to force the OPCache to check php files on each request.

Upvotes: 7

troseman
troseman

Reputation: 1878

using APC? check your APC section in php.ini

make sure apc.stat=1

http://www.php.net/manual/en/apc.configuration.php#ini.apc.stat

Upvotes: 0

mal
mal

Reputation: 1871

I had the same issue. My was related to APC extension caching. You can use the PHP function apc_clear_cache.

Upvotes: 1

Related Questions