Top Nav

Clearing PHP opcache

Great article on how to clear the PHP opcache:

https://ma.ttias.be/how-to-clear-php-opcache/

To facilitate use on a Plesk server created script and mapped into namespace:

https://acme.com/opcache_clear

Here’s the script:

And here’s the Apache config to map into a virtual host:

This above config should be placed in the “Apache & nginx setting” screen in the “Additional directives for https” field. In addition to setting the alias path we’re also setting the PHP handler.

Additionally under “Password protected directories” added password protection for “/opcache_clear”. This is just a placeholder for the password file which is referenced in the above config.