
When using Xdebug with the built-in PHP server be sure you have the proper configuration in your php.ini file. Will will need at a minimum the following settings:
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.idekey = PHPSTORM
xdebug.remote_host = 127.0.0.1
# Do not assume port 9000 is free
xdebug.remote_port = 9000
If you run into an issue running Xdebug via PHPStorm, or another IDE, when using the built-in PHP server on macOS, or Ubuntu, you might have a conflicting port 9000 with php-fpm.
You can check the 9000 port using the following command on:
sudo lsof -i tcp:9000
To check the port php-fpm occupies use the following command:
sudo lsof -i -n -P|grep php-fpm
Xdebug and php-fpm, or another service, might both be running on port 9000. The simple fix for this is to change the Xdebug port to 9001.
xdebug.remote_port = 9001
Then in PHPStorm set the Xdebug port to 9001 under Preferences | Languages & Frameworks | PHP | Debug
.
If you are using xdebug 3 or later use integer xdebug.client_port = 9003
instead of xdebug.remote_port = 9000
.
Leave a Reply