How to debug with PHPStorm and PHP builtin server

I was playing with Symfony recently, and I needed to setup debug in PHPStorm using the PHP internal web server.

I’ve setup xdebug with PHPStorm in multiple environments, and each time I find a different glitch. Lucky me 🙂

So, I will assume that you have PHP, xdebug, PHPStorm installed.

These are the steps:

  1. Edit the xdebug configuration file (in Ubuntu you can find it in /etc/php5/cli/conf.d/20-xdebug.ini) and add the following lines:
    xdebug.remote_autostart = 1
    xdebug.remote_enable = 1
  2. Start the server with php bin/console server:run
  3. In PHPStorm, click the phone handle icon.phpstorm_phone_handle_icon
  4. Set a breakpoint and load your application in the browser.

You’re done! Can you believe it?

This time the difference was that remote_autostart flag!

Until for next xdebug setup tip, bye 😉


Posted

in

by

Comments

One response to “How to debug with PHPStorm and PHP builtin server”

  1. Martin Avatar
    Martin

    Pretty old, but I can just double your opinion: “each time I find a different glitch”

    Its pretty annoying, every time I feel like a noob again when I am setting up Xdebug for a new project or on a new machine.

    That one was helpful, good work!

Leave a Reply

%d bloggers like this: