The script language PHP is used for dynamic websites, such as forums or WordPress blogs. Here, the source code of the PHP files must be converted into so-called byte code, which can then in turn be processed by the web server in such a way that it can send the data to the browser. Because the byte code is immediately discarded after the PHP script is executed, this process has to be repeated every time the script is called, which in turn takes time. To avoid this, OpCache offers the possibility of optimising the byte code and saving it for later script calls. Because the script does not have to be converted anew with each new execution, the script can be executed more quickly and, for example, the web page can be displayed more quickly.
With OpCache there are 2 ways in which the code can be stored, once in memory and once as a file within the web hosting service. The storage in memory is activated by default, if you also want to store the code as a file within the web hosting offer, please proceed as follows.
Enable PHP OpCache
First log into the hosting panel and then click on the menu item “Webspace” on the left-hand side and then select your hosting account to be edited. Then click on the button “Settings” under “PHP” and select the setting item “opcache.file_cache”. Now enter
%HOME%/.cache/opcache.%PHP%
The cache directories .cache/opcache.phpXX must not be deleted! If they are accidentally deleted, the website will no longer be accessible.
OpCache and the storage space
The cache files are created within your hosting account and occupy corresponding storage space, which is deducted from your available web space. For example, when you update PHP or change PHP versions, new files are created in a new directory, but the old files are not deleted. You should therefore delete older OpCache files occasionally, otherwise your web space could be exhausted at some point.
You can delete the files, for example, via FTP access or automatically via cronjob. Please note, however, that you only delete the contents of the cache directories. Deleting the .cache/opcache.phpXX folders will result in your website no longer being able to run