Phpstorm server mappings with WordPress xdebug and vagrant


my dev environment consists of a vagrant box with a shared /projects folder on my local machine, and I develop WordPress sites
I have xdebug 2.2.3 which connects fine but has a strange behavior.

when I use zero config debugging, then I get prompted to select a file to debug, basically a list of all index.php files found in my project.
breakpoints don't work though. If I check the option to stop on first line of code, it does stop but it's not very useful becaues I want to inspect the vriables at the breaakpoint.
Basically I'm not sure how to configure the server folder mapping and make the debugging work properly.



Hi there,

You need to map remote location of your project to local location. The remote path should be real/resolved path, in case symbolic links are in use. This should be the path as xdebug sees it (which uses resolved paths).

In most cases you just map top level folders (e.g. C:\Projects\ --> /var/websites/ ) and the rest (sub-folders/files) will be calculated automatically (e.g. C:\Projects\\app\functions.php --> /var/websites/ /app/functions.php ).

Path mappings can be set up at "Settings | PHP | Servers"

breakpoints don't work though.

Missing/wrong path mappings is the most common reason.

Check out this blog post (video!!): Webinar Recording: Debugging PHP with PhpStorm


It should be your domain name (how you accessing it in a browser).

For the host would be

If you are using then this filed will be filled by IDE automatically (when it popping up asking you to match a file).


Well ... have not seen anything like that before (I mean -- empty host name) in my practice. Must be some specific configuration (OR .. quite likely, web server misconfiguration)...

1) What is the URL that you are using in a browser to access this site?

2) What is the value of $_SERVER["SERVER_NAME"] when you execute the script on this server using that URL?

3) What is the web server software (Apache/nginx/etc) ?

In your previous post, the absolute path on the server is WRONG (you have typed the same as local path). It should be (based on your new screenshots; double check the spelling, I typed from your pics):

  • Local: /Users/pauldewouters/hmn/projects/
  • Remote: /srv/www/

1) What is the URL that you are using in a browser to access this site?

2) What is the value of $_SERVER["SERVER_NAME"] when you execute the script on this server using that URL?
I'll check

3) What is the web server software (Apache/nginx/etc) ?




The host name on path mappings screen definitely should be "".

If $_SERVER["SERVER_NAME"] is empty or looks like empty (which looks like it -- based on your screenshots; as PhpStorm is unable to fill this field automatically), then it's likely to be either web server misconfiguration (most likely) or it's manually overwritten in your code somewhere (which is rather unlikely and I have no clue why it should be done in first place).

If it's a nginx misconfiguration, then I will be unable to help you here -- I'm not familiar with it (never worked with it myself).

If you have time -- see if you can setup another vagrant box with Apache as web server -- see if it will do any different.


no value

looks like it has n value. I'll ask our server admin if he can fix this and get back to you


Well .. for me it's clearly nginx config issue.

Have a look at (or google for "nginx php" or somthing like that)

Instead of what advised there (fastcgi_param SERVER_NAME $server_name;) you (or admin) can try "fastcgi_param SERVER_NAME $host;" or maybe even  "fastcgi_param SERVER_NAME $http_host;"


Yes, I've noticed that as well. See my updated previous post -- it has suggestions that I found by googling for "nginx php server_name" (first page of results)


woohoo! setting server_name to $host solves it for me, thanks for your help :)


Please sign in to leave a comment.