Skip to content

Instantly share code, notes, and snippets.

@Im0rtality
Last active March 17, 2023 14:36
Show Gist options
  • Save Im0rtality/9710254 to your computer and use it in GitHub Desktop.
Save Im0rtality/9710254 to your computer and use it in GitHub Desktop.

Revisions

  1. Im0rtality revised this gist Mar 22, 2014. 2 changed files with 19 additions and 8 deletions.
    22 changes: 15 additions & 7 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,4 @@
    In guest:

    1. Create file `/usr/bin/debug` with contents added below (file `debug` below)
    2. Make it executable `$ sudo chmod 0777 /usr/bin/debug`

    In host:
    ### In host:

    1. Go to PHPStorm `Settings > Project settings > PHP > Servers`
    2. Add server with following parameters:
    @@ -12,4 +7,17 @@ In host:
    - Debugger: Xdebug
    - [v] Use path mappings
    - Map your project root in host to relative dir in guest
    - Hit OK
    - Hit OK
    3. PHPStorm > Run > Start listen for PHP Debug connections
    4. Put a breakpoint

    ### In guest:

    1. Find where your Xdebug config is stored. Run `$ php -i | grep ini` and look for `*xdebug.ini` or `*custom.ini` - depends on configuration (mine was in `/etc/php5/cli/conf.d/zzzz_custom.ini`)
    2. Add following `xdebug.remote_host = 11.22.33.1`, when box ip is `11.22.33.*`
    3. Create file `/usr/bin/debug` with contents added below (file `debug` below)
    4. Make it executable `$ sudo chmod 0777 /usr/bin/debug`
    5. Run your script prefixed with `debug`:
    - `$ debug app/console cache:clear`
    6. Debugger window should open in IDE

    5 changes: 4 additions & 1 deletion debug
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,5 @@
    #!/bin/sh
    env PHP_IDE_CONFIG="serverName=vagrant" XDEBUG_CONFIG="idekey=PHPSTORM" SYMFONY_DEBUG="1" $@
    env PHP_IDE_CONFIG="serverName=vagrant" XDEBUG_CONFIG="idekey=PHPSTORM" $@

    # for Symfony apps use following
    # env PHP_IDE_CONFIG="serverName=vagrant" XDEBUG_CONFIG="idekey=PHPSTORM" SYMFONY_DEBUG="1" $@
  2. Im0rtality revised this gist Mar 22, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,6 @@ In host:
    - Name: `vagrant` (same as `serverName=` in `debug` script)
    - Host, port: set vagrant box IP and port
    - Debugger: Xdebug
    - [+] Use path mappings
    - [v] Use path mappings
    - Map your project root in host to relative dir in guest
    - Hit OK
  3. Im0rtality revised this gist Mar 22, 2014. 2 changed files with 15 additions and 2 deletions.
    15 changes: 14 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,15 @@
    In guest:
    1. Create file `/usr/bin/debug` with contents

    1. Create file `/usr/bin/debug` with contents added below (file `debug` below)
    2. Make it executable `$ sudo chmod 0777 /usr/bin/debug`

    In host:

    1. Go to PHPStorm `Settings > Project settings > PHP > Servers`
    2. Add server with following parameters:
    - Name: `vagrant` (same as `serverName=` in `debug` script)
    - Host, port: set vagrant box IP and port
    - Debugger: Xdebug
    - [+] Use path mappings
    - Map your project root in host to relative dir in guest
    - Hit OK
    2 changes: 1 addition & 1 deletion debug
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    #!/bin/sh
    env PHP_IDE_CONFIG="serverName=tsp" XDEBUG_CONFIG="idekey=PHPSTORM" SYMFONY_DEBUG="1" $@
    env PHP_IDE_CONFIG="serverName=vagrant" XDEBUG_CONFIG="idekey=PHPSTORM" SYMFONY_DEBUG="1" $@
  4. Im0rtality revised this gist Mar 22, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,2 @@
    a
    In guest:
    1. Create file `/usr/bin/debug` with contents
  5. Im0rtality created this gist Mar 22, 2014.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    a
    2 changes: 2 additions & 0 deletions debug
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    #!/bin/sh
    env PHP_IDE_CONFIG="serverName=tsp" XDEBUG_CONFIG="idekey=PHPSTORM" SYMFONY_DEBUG="1" $@