9

I have a Ubuntu and a centos server. On the centos server, whenever I change php files, they reflect immediately, but on Ubuntu, I have to restart php-fpm to make them reflect.

I didn't find anything relevant.

Anyone has similar experience?

2
  • 1
    some kind of caching?
    – user557846
    Commented May 24, 2015 at 1:48
  • I thought so, but I didn't find any configuration about caching on php file
    – newme
    Commented May 25, 2015 at 2:28

2 Answers 2

12
  • What version of php on which version of ubuntu ?
  • Do you have any reference of opcache.enable=1, somewhere in your php config maybe (/etc/php5/fpm/conf.d/) ?

In a temporary php file, put something like this (don't forget to remove it afterward):

   <?php
   phpinfo();

On recent PHP version (5.5+), search for Zend OPcache section and see if it's active or not It might be enabled in . If so, take a look to opcache doc to configure it properly (according the dic, opcache.revalidate_freq to 0 for a check on each request). https://php.net/manual/fr/opcache.configuration.php#ini.opcache.revalidate-freq

Another cause might be php apc (for php 5.4 and lower).

0
5

My search for same thing landed me here. Opcache is enabled. And for the setting mentioned in above link to (not English) PHP docs, I only caught that "0 will result in OPcache checking for updates on every request. "

However, I didn't initially catch the next line. So, in an effort to save others a few extra minutes, here's the info:

You'll need to edit these two settings in your either your php.ini or ext-NN-opcache.ini (auto include) and then restart php-fpm with service php-fpm restart in order to see changes.

; after how many seconds should code/file be checked for changes (expire)

opcache.revalidate_freq=5

; If this is off, the above does not matter. won't be checked. (no expire)

opcache.validate_timestamps=1

Here's the English version link: https://secure.php.net/manual/en/opcache.configuration.php#ini.opcache.revalidate-freq

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