Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using Xdebug on Devilbox with PhpStorm and Postman

Host OS

Tested on:

  • openSUSE 15.1 Leap
  • Fedora 30

Check before setup:

  • Accept in the firewall the port 9000 TCP

Docker

(…setup without sudo…)

Check existance of the docker group

sudo groupadd docker

Add the current user to the docker group

sudo gpasswd -a $USER docker

Log out end log to again to accept the changes!

Test the permissions

docker run hello-world

Devilbox

(…for multisite setup see the Devilbox documentation…)

cd /_devilbox_install_dir_/cfg/php-ini-X.X/
cp devilbox-php.ini-xdebug xdebug.ini
nano xdebug.ini

Change these settings:

xdebug.default_enable  = 1
xdebug.profiler_enable = 1

xdebug.remote_enable       = 1
xdebug.remote_autostart    = 0
xdebug.remote_handler      = dbgp
xdebug.remote_port         = 9000
xdebug.remote_connect_back = 1

xdebug.idekey     = PHPSTORM
xdebug.remote_log = /var/log/php/xdebug.log

Save and restart DevilBox:

cd /_devilbox_install_dir_
docker-compose stop
docker-compose rm -f
docker-compose up -d

PhpStorm

Settings / Languages & Frameworks / PHP

  • Set CLI Interpreter by clicking on
  • Add a new interpreter by clicking on + then choose From Docker, Vagr…
  • Tick Docker and add the Docker Server and then choose under Image name : devilbox/php-fpm:X.X-work…

Settings / Languages & Frameworks / PHP / Debug

Xdebug
    Debug port: 9000 ☑️ Can accept external connections
    ☑️ Force break at first line when no path mapping specified
    ☑️ Force break at first line when a script is outside the project

Settings / Languages & Frameworks / PHP / Debug / DBGp Proxy

IDE key: PHPSTORM
Host:    0.0.0.0
Port:    9000

Settings / Languages & Frameworks / PHP / Servers

  • Add a new server +
  • Set the Name of the server
  • Set values of Host to localhost : Port to 80
  • ☑️ Use path mappings (…)
File/Directory Absolute path on the server
/home/user/devel/htdocs /shared/httpd/devel/htdocs

Postman

Under Query Params set the key: XDEBUG_SESSION_START and the value PHPSTORM Click on the link Cookies (beneath the Send button) and add a new cookie for the corresponding domain:

XDEBUG_SESSION=PHPSTORM; path=/; domain=.yourlocaldomain.loc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.