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"