I had an issue with Xdebug not stopping at breakpoints except for the first line of code in only one of my local PHP projects. Strangely enough xdebug_break() still worked everywhere I put it. My first thought was that a PHPStorm project setting with the debugger was awry. After searching and trying many different php.ini settings someone suggested checking the xdebug logs for anomalies.
In your php.in file specify a Xdebug log path file and then restart apache.
- xdebug.remote_log=/[path to where you want the log to live]/xdebug.log
After setting a breakpoint on line 7, running the script, checking the log, and seeing that my breakpoint was being registered, the only inconsistency I saw was the case in the file path.
<- breakpoint_set -i 10 -t line -f file:///Users/na/PhpstormProjects/Sample/httpdocs/index.php -n 7
-> <response xmlns=”urn:debugger_protocol_v1″ xmlns:xdebug=”http://xdebug.org/dbgp/xdebug” command=”breakpoint_set” transaction_id=”10″ id=”429140001″></response><- stack_get -i 11
-> <response xmlns=”urn:debugger_protocol_v1″ xmlns:xdebug=”http://xdebug.org/dbgp/xdebug” command=”stack_get” transaction_id=”11″><stack where=”{main}” level=”0″ type=”file” filename=”file:///Users/na/PhpstormProjects/sample/httpdocs/index.php” lineno=”4″></stack></response>
Turns out this particular project folder name was capitalized and others were not. This was probably a project path setting within PHPStorm somewhere; however, I changed the folder to be all lowercase in the finder and Xdebug began working perfectly.
So if you can’t get a breakpoint to work, check the Xdebug logs and your project path names. Hopefully this saves you from a few hours of frustration.