Search code examples
phplaravelphpstormxdebug

Xdebug Breakpoints Not Working in Laravel


I have Laravel 5.7 running on Homestead. I also have Xdebug enabled in the PHP-FPM php.ini file.

PhpStorm is validating the Xdebug setup. If I drop a simple PHP file, such as:

<?php phpinfo(); ?> 

And also create a breakpoint on the server, the breakpoint is being hit in PhpStorm on the requesting the page.

However, setting a breakpoint inside Laravel doesn't result in the breakpoint being accessed, even with a simple page request.

If I set a breakpoint in the public/index.php file, this is hit, but a breakpoint in routes/web.php is not hit regardless of where I place it.

I'm a bit lost, please help.


Solution

  • Resolved. The fix lay in missing path mappings for the Laravel application files.

    Adding mappings for the public/index.php and code/ directories in Prefs > Languages & Frameworks > PHP > Server fixes the issue and I can now hit breakpoints :)

    Path mappings in PHPStorm