# How to debug and log PHP OPcache Issues

PHPServer Side ProgrammingProgramming

The OPCache can be temporarily disabled by adding the below code to the script−

ini_set('opcache.enable', 0);

This can be used to tell whether OPCache was the reason behind the script failing. Due to this, the user will not have to go through every extension and turn them on/off to see which extension caused the issue.

Finding the log that shows which file and what was the reason behind the script failing (when OPCache is enabled).

If the user has more information about the application they are trying to debug, this is a feasible option to work on.

ini_set('display_errors', 1); error_reporting(~0);


If the above two solutions don't work, the user can use Xdebug to debug their application. It has a remote debugger that allows the user to see what data structure the application uses and helps in walking through the code interactively, as well as debugging it.

Published on 27-Dec-2019 12:45:34