Nieuw ticket Mijn tickets Inloggen Liquid error: undefined local variable or method `_routes' for #<Liquid::Strainer:0x0000559a90cd9e40>

Flush the PHP OPcache

Gewijzigd op Fri, 28 Oct 2022 om 09:59 AM

Disclaimer: MageHost has joined forces with Savvii. Therefore, these articles are only relevant to existing MageHost customers. For more information on this, visit www.savvii.com/en/magehost.  


The PHP OPcache increases the performance of your shop by caching processed PHP source code in memory. The MageHost servers are configured to re-read a script when it is changed.

However if you use a deploy method which switches to a new version of the code by replacing a symlink to a new release, PHP does not detect the change. This will cause strange things to happen.

If you use a deployment method which changes one ore more symlinks to point to the new version of the PHP code, you will need to flush the OPcache.


Easy & Recommended: Reload PHP using SSH

Execute this line in SSH, or preferably, in a script after the deploy to flush the PHP OPcache:

$HOME/bin/reload_php.sh

Note: if you are running our mh_queue_consumer.service, this will also be restarted with above script.


Advanced: Web Script

Create a file ~/httpdocs/flush_php.php containing:

<?php 
opcache_reset(); 
clearstatcache(1); 
echo "OK";

You can call this script in a browser or you can call it in an SSH shell:

curl -Lk "https://$VHOSTDOMAIN/flush_php.php"

In case this does not work because of domain issues, you can try:

curl -Lk "http://$VHOSTIP/flush_php.php"


Was dit artikel nuttig?

Dat is fantastisch!

Hartelijk dank voor uw beoordeling

Sorry dat we u niet konden helpen

Hartelijk dank voor uw beoordeling

Laat ons weten hoe we dit artikel kunnen verbeteren!

Selecteer tenminste een van de redenen

Feedback verzonden

We waarderen uw moeite en we gaan proberen om het artikel te verbeteren