Monday, 3 September 2018

How To Debug PHP OPcache Issues

I am using WAMP on Windows 10, running PHP 7.2 with Apache 2.4

When I am turning on OPcache, a page I am loading crashes with the following error in Chrome:

ERR_CONNECTION_RESET

I checked the php error log and Apache error log and could not find any error reported. I tried to disable Xdebug, still same crash and no errors in the logs. Turning off OPcache or switching to php 7.1 or below resolves the issue.

I was looking everywhere for some information on how to debug what causes OPcache to fail (and the reason) as turning it off is not a solution, but couldn't find anything helpful (also checked similar SO questions like this one which also has no resolution), so I am reaching out to the experts here for assistance, which I am sure will also help others.

Thank you.

P.S. Note that after a very long manual trial and error I was able to find the file in my php application that was causing OPcache to fail and blacklisted it in OPcache configuration, but I am still looking for an easy way to debug such issues without having to go through & check each file on the server. I also don't know why it fails, so finding the cause for the failure will help file bug reports to the OPcache developers.

EDIT: As requested in the comments, I have added a comment with the pastebin of the file that caused the failure in my case.

TL;DR

I am looking for:

1) A way to easily determine that OPcache is the extension that makes a script fail, without having to go through each extension and turn them on/off until finding the extension that fails.

2) Easily find a way/log that shows which file and the reason/s it fails when OPcache is enabled.

Thanks again



from How To Debug PHP OPcache Issues

No comments:

Post a Comment