SSH + XDebug + PhpStorm

Hi.

CLI debugging. I never did that. Until today. My tests started to fail and I had no idea why.

So that’s my story why I started to debug tests in the CLI via SSH.

Here’s a list of ingredients:

  • PhpStorm,
  • remote SSH (I’m using Vagrant),
  • PHP + XDebug.

First thing what we need to do is to configure the PhpStorm.

Open your setting and go to Languages & FrameworksPHPDebugDBGp Proxy.

dbgp proxy

  1. Fill the field IDE key with key you choose (I chose PHPSTORM and I recommend it).
  2. In the Host field put the IP which is seen by remote (run echo $SSH_CLIENT on the remote to see it).
  3. Default Port is 9000 and you should not change it.

Next thing to configure is Language & FrameworksPHPServers.

server

  1. Put the server Name.
  2. In the Host field type the IP address, same as on DBGp Proxy.
  3. If you set other Port for DBGp Proxy then change it here.
  4. As we are working on XDebug you don’t have to change the Debugger :).
  5. My remote has different folders structure so I had to set path mapping, probably you will have to do the same.

Ok PhpStorm is ready to go.

Now go to SSH and run this command:

In the first line put your Server Name which you’ve just set. In the second just update the remote_host with the IP address and change the idekey to yours.

The last thing to do is to enable listening for debug connections in the PhpStorm. Just click the button in the top right corner:

enable debug

Ah I forgot, please add some breakpoints! And then you can run your tests / scripts etc.

 

Enjoy 😀

2 przemyślenia nt. „SSH + XDebug + PhpStorm”

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *