Debugging on Platform.sh

We are in the process of deploying a lot of sites on to the excellent Platform.sh infrastructure at the moment.  As with all these things, we hit a few snags along the way.  The way that we worked around this was to install the Xdebug extension and use it to step through the code.

Firstly you need to enable the extension. Edit your .platform.app.yaml file to add the extension.

runtime:
    extensions:
      - xdebug

You will need to check that code in and deploy it to one of your containers.

Now that you have XDebug installed, you need to get it to talk to your local IDE.  The easiest way is via an ssh tunnel.  Open a terminal and run the following command, changing the user to that of your project hash.

ssh -R 9000:localhost:9000 bvzmhsdbu6g3g-master@ssh.eu.platform.sh

If you don’t know where to find your ssh details, it is in the web interface under Access Info.  Click the clipboard to the right to copy the ssh connection.

ssh access settings

Assuming that you have your IDE set up to accept Xdebug settings, you can now start it listening on port 9000 and tell the website to start debugging.

Xdebug helper in the address barIf you’re using Google Chrome, then Xdebug helper is a great little icon that sits in your address bar.  Rather than you having to add an attribute to the address, you can simply click this friendly little bug to add a cookie to the request.


Posted

in

,

by

Comments

Leave a Reply