How do I make Xdebug work in PhpStorm?

I tried all the steps from Xdebug nightmare - #8 by Glauber.
But I do not see any dialogue box in PhpStorm as mentioned below.

I am not using the LocalWP addon, I disabled it.

Can someone please reply?

Hi, @abdnafees. It’s worth trying the steps in the answer I gave here with a fresh site:

1 Like

IT WORKED!!! I spent a week trying to solve this! Thank you so much!!!

1 Like

@nickc But it opens up a connection with local-bootstrap.php file everytime I set up a breakpoint. Any solution for this?

Great to hear that worked, @abdnafees!

But it opens up a connection with local-bootstrap.php file everytime I set up a breakpoint. Any solution for this?

Did you do step 3?

In PhpStorm, visit Settings → PHP → Debug, untick “Force break at first line when a script is outside the project” and click “Apply”.

If you’ve done that, it should only break on scripts where you set a breakpoint.

Already did that.


Here are my settings.

Strange, I cannot reproduce that so far unless I tick, "Force break at first line when a script is outside the project”. If restarting PhpStorm and Local doesn’t help, you could also try unchecking “Force break at first line when no path mapping specified” on that same settings page.

Worth checking your mappings at PHP → Servers too. If you’re opening the public folder directly in PhpStorm as recommended there should be no mappings present (“use path mappings” should be unticked). Mine looks like this:

I deleted the Server and now I get this dialogue box. Are the settings correct here?

Yes, you can click “public” and then Accept and it will add the server again.

After that, as long as “Force breat at first line when a script is outside the project” is unchecked, and you have a breakpoint set up, it should break at your breakpoint but not at local-bootstrap.php.

Nope, it is still breaking at local-bootstrap.php.

Does it have anything to do with this setting here?

Now I am getting this error from PhpStorm.
Screenshot 2024-05-20 at 2.03.31 PM

Does it have anything to do with this setting here?

No, that should be ignored once the breakpoint is met, since it’s outside of the project’s public folder.

Now I am getting this error from PhpStorm.

Have you set a breakpoint inside the public folder?

Yes. Inside a custom theme that I am working on.

I recommend putting the breakpoint somewhere that is guaranteed to break (such as in wp-config), at least until you’re confident the Xdebug setup is configured correctly.

Got it, will do.