Espie's picture

Hi,

I deployed a default Lampstack 15.0 vmdk on my ESX server and start playing with it. For some reason I don't see my PHP file changes right away the most of the time. If I change some text, most of the time it takes a few minutes to be visible. It seems to be PHP related as HTML files changes are parsed right away.

Anyone experienced the same and/or have a fix?

Thanks,
Dennis

Forum: 
Tags: 
Jeremy Davis's picture

By default PHP opcache is enabled. AFAIK, you should be able to disable that fairly easily, via a number of methods, depending on what best suits your purpose. Please note, I have actually tested any of these, but hopefully I've got it right...

If you want it system wide, then probably the easiest is via the php.ini file. The default ini file should be /etc/php7.0/apache2/php.ini Add the line:

opcache.enable=0

Alternatively, if you just want to disable it for a single php file (AFAIK it will also propagate to any other php files processed after processing this file, so adding it to a settings.php/config.php/etc file of a web app, should disable it for that whole web app), at the top of the file, add:

ini_set('opcache.enable', '0');

Anther option is to do it via Apache, within the relevant Directory block, add:

php_flag opcache.enable Off

Alternatively that could instead be added to an .htaccess file within the relevant directory, although make sure that within the virtual host config you have AllowOverride All.

Hope that helps. It'd be great if you could confirm either way.

Add new comment