1. Install xdebug:
sudo apt install php-xdebug
2. Check installation:
Now, (1) open the page, (2) search for xdebug, and (3) get the xdebug.ini path:
Down on the same page, check if the module is enabled:
Now you can remove the
phpinfo.php file (optional):
cd rm phpinfo.php
3. Add these lines to
xdebug.remote_enable=1 xdebug.remote_host=127.0.0.1 xdebug.remote_connect_back=1 # Not safe for production servers xdebug.remote_port=9000 xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_autostart=true
4. Install Atom plugin:
In Atom, install package
php-debug by gwomacks:
Install Packages and Themes >
I recommend you to install the suggested plugins:
If you click to install the suggested plugins, wait until you get a success notification for each plugin before closing Atom.
5. Re-start Atom editor
6. To add breakpoints, click on the marker ruler:
WARNING: There are 2 breakpoint rulers (the blue dots):
Use the one at right (the small blue dot)
1. If it doesn’t work, you probably edited the wrong
xdebug.ini file. The path with
/cli/ folder on it is for the standalone
php -S command. If you are using Nginx/Apache or FPM, then it’s a different path.
2. In older versions, you had to OPEN the “php debug” panel. You can open it by clicking on the bottom-left button on Atom. If the “php debug” panel is closed, the breakpoints WILL BE IGNORED. This has been fixed in more recent versions, but some bugs can return – so double check this.
3. There is a FAKE breakpoint: the one on the left. The correct one is the one at RIGHT. If you set the other breakpoint, it will be ignored.
4. Re-start Atom.