Cloudlinux Opcache (disabled)
This situation has me scratching my head, so hopefully someone can shed some light.
I have Xdebug working on a cPanel/WHM server hosted site using PhpStorm as the IDE and Xdebug helper on my browser to trigger the Xdebug session via an IDE key. EDIT: The debug.mode = debug.
Normally this all works fine, and I've been debugging things without issue until now. The situation now is that I have a weird 404 error that I'm trying to locate the cause of.
When the Xdebug session is disabled (via the browser plugin), the error happens (a 404 page not found) but when the Xdebug session is active (again via the browser) the page (when refreshed) displays as it was meant to.
Further symptoms/variables are that the bug doesn't happen when the visitor is logged into an account on the site, so my gut is telling me this might be something related to cookies or session data but the fact that Xdebug is affecting the outcome is both weird and frustrating because I can't debug a problem that doesn't exist when Xdebug is watching...
Any suggestions?
Update 1: After adding logging points manually in the code I've identified that the code does progress, ignoring the breakpoints it seems, and gets so far before a bug (potentially an ajax call) redirects the resulting output to a 404 not found instead of the 503 error I can see in the $_SESSION output.
Update 2: After further investigation I discovered that the issue is also triggered by the debug.mode setting.
debug and trace both cause issues (when xdebug session is inactive) profile, develop, gcstats and coverage do not trigger the 404.
Update 3: After checking compatibility matrix for Xdebug I checked opcache was off (it was) and then tried switching to PHP version 8.3 (down from 8.4 originally set). 8.3 works without the issue.
This explains why another site still on PHP 7.4 wasn't showing the same problem with debug turned on.
So to summarise:
- PHP 8.4, xdebug.mode = debug/trace = strange incompatibility
xdebug_break();you can place into the code which will create a debugger breakpoint there. It is easy to remove afterwards per search and replace, as easier to add than intermediate logging points (may depend, but most often while exploring temporarily).