I have setup and docker machine that runs my application. In this docker machine xdebug is enabled with these xdebug.ini settings.
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_host=10.5.0.1
My local machines IP is 10.5.0.1
When I try to run my application on command line, it connects back to PhpStorm debugger. But because of there is no path mapping it stops at the first line of the script, break points doesn't work. Break point cursor is not visible, I can't track the code by F8 key.
Also, it must show some kind of path mapping error Debugger->Variables windows, but it doesn't show any error.
How to fix this?
I could fix this problem, PhpStorm can not handle if serverName is not configured.
1. Setup environment variables:
export XDEBUG_CONFIG="idekey=PHPSTORM"
export PHP_IDE_CONFIG="serverName=web_server_cli"
2. Setup path mapping for that servername:
Go to Settings > Languages & Frameworks > PHP and create a server with a hostname web_server_cli
settings > languages and frameworks > php > servers Add your server, and add your path mapping! An example would be C:\Sites\mysite mapped to remote /var/www/mysite or similar
You need to set up a "server" configuration in "Settings > Languages and Frameworks > PHP > Servers" which maps the paths as seen on the server to the paths in your project.
Normally, you would enter a URL into "Host" and set "Port" to the HTTP port, e.g. 80 or 443. For CLI scripts, the info to put in here will be based on your connection to the server where the CLI script runs. For instance, if you SSH to 192.168.42.42 on the standard SSH port (22), you would enter "Host: 192.168.42.42", and "Port: 22".
To find out what details you need to set up, go into "Settings > Languages and Frameworks > PHP > Debug", enable "Force break at the first line when no path mapping specified", and make sure "Ignore external connections through unregistered server configurations" is not ticked. Then click "Listen for debug connections" in the toolbar, and run your script; a dialog box should pop up showing the "Server name:" and "Server port:" it is trying to match, as well as confirming the remote file path. Click "Ignore" on that dialog, set up the server mapping, and try again, and you should get a proper debug session.