How to get XDebug to work with Wordpress Theme?

Hi!

I am develping a wordpress theme. I'd like to use Xdebug for debugging purposes but can't seem to get it to work.

Here's my setup:

In the main folder of my PHPStorm project I have two folders:

build
    here are my development files including non-minified versions

dist
  this folder is the theme folder that is generated from the build folder

I have set up a grunt workflow that rebuilds the dist folder from by build folder when changing any file using a file watcher.

I also have a webserver set up on my local machine. It is on a different drive containing a fully setup wordpress installation.

I have set up a symbolic link to mirror my dist folder into the wp-content/themes folder. So when surfing localhost, I can see my theme and all changes I do to it.

Now I'd like to use Xdebug but don't know how to get it to work. The entry point for Xdebug is the Wordpress index.php which is not part of my project - so I can't map it within PHPStorm.

Any ideas on how to get this working?

Cheers,
Guenter

0
4 comments

You don't need breakpoints in a "non-project" files such as index.php in your case? You're going to place breakpoints only in files located in your project (build & dist folders)? In that case you can just go with "Zero-config debug".

You can also delete any existing configurations at File | Settings | PHP | Servers so that next time you start debugging you would receive a window similar to this:

You can also enable these options while you're trying to set this up:

0

Hi Dimitry,

Thank you for taking the time. I've done exactly that, but its not working:

When I start debugging, the "Incoming Connection" dialog pops up but the list of files to choose from, does not include any file, that matches my project. Because of Wordpress it only lists the index.php file that are inside my project, but not the one that is outside. The file I am working on does not appear at all.

I am using PHPStorm/Xdebug on a non-wordpress-project without any problems. But this one gives me a headache.

0

> When I start debugging, the "Incoming Connection" dialog pops up but the list of files to choose from, does not include any file, that matches my project. 

But you don't have to select any at this stage. Just accept the connection and let debugger run further. 

> The file I am working on does not appear at all.

So when you hit "Accept" - does IDE react somehow to a debugging session?

 

Also, I would suggest to write us via Help | Contact Support & ask to pass the ticket to me - that way you could probably share your IDE & XDebug logs and I'd be able to see an unobfuscated picture.

0

After accepting, nothing happens...

Thanks for the time you're spending!

#3807062

1

Please sign in to leave a comment.