Smarty templates needs to be reload twice to see changes

I was having some issues with Smarty, when i updated a template i have to reload it twice to see my changes.

After some digging i realized that Zend OPcache was causing it.

So i jut disable Zend OPcache and now is working as it should.

just edit php.ini as root.

sudo nano /etc/php5/apache2/php.ini

Find the line where “opcache.enable=1” is and change it to 0, if it has a “;” remove it and that’s all

[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=0

Then we simple reload apache

  1.  
  2. sudo /etc/init.d/apache2 restart
  3.  

One thought on “Smarty templates needs to be reload twice to see changes

  1. Razvan

    I had the same issue, but I fixed it like this by adding this config param:

    opcache.validate_timestamps=1

    opcache is still enabled, but now it checks for file system changes. I just enabled the feature 10min ago, but I tested it several times with very small template changes (1 letter) and it always worked.

    Regards,
    Razvan

Leave a Reply

Your email address will not be published. Required fields are marked *