Although I now realize that the trick to getting Eclipse to stop at your breakpoints, when PHP scripts are executed from POST and GET requests from ajax/curl, is to make sure the XDEBUG_START_SESSION
variable is set in all the requests you want the debugger to be aware of, this seems to only work when all of your paths on the web server are the normal relative kind.
However, if you happen to have some aliased paths on the webserver, such as by way of the httpd Alias directive, XDebug then has trouble associating the paths of the files in your workspace with their path in a site URL.
I have the following directory setup:
Here's how the web server is setup:
ServerName test.local
DocumentRoot "C:\Users\me\projects\testproject\start\here"
Alias /post "C:\Users\me\projects\testproject\post"
<Directory "C:\Users\me\projects\testproject">
Require all granted
</Directory>
I would think this is what the Path Mapping tab is for, found in Debug Configurations -> Server -> Configure... -> Path Mapping
. Everywhere I look, I'm told to set Path on server
to the filesystem path on the webserver for a directory or file, and to set Local path
to its path in your filesystem or workspace. I also tried setting Path on server
to the site URL path I wanted to map to the Local path
, but neither configuration results in breaking on a line in a POSTed PHP script.
I turned on logging for XDebug, to compare messages for a breakpoint that it properly stops on, because it's in the file the the debugger starts at, and a breakpoint in the script executed by way of POST request, which is unfortunately not stopping. It will stop in this file if the /post
path correspond with a post directory at the DocumentRoot
, but not if the post directory is somewhere else and the "fake" /post
path in the site URL is aliased to it.
In my XDebug log file, there are several log entries for line 28 in index.php, the file for which it is properly breaking. Line 3 in message.php has an entry as well, and the URL-encoded path looks correct, but I'm not seeing the same kind of entries.
How can Eclipse be configured to know that /post
on the server means /My Project/post
in the workspace?