Skip to content

Instantly share code, notes, and snippets.

@mohokh67
Last active January 24, 2018 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohokh67/a7a9b23932f9ebe02bfda3d7e837ecec to your computer and use it in GitHub Desktop.
Save mohokh67/a7a9b23932f9ebe02bfda3d7e837ecec to your computer and use it in GitHub Desktop.
Configure XDEBUG and PHPStorm

Configure Xdebug

  1. Copy all phpinfo() output to this URL: https://xdebug.org/wizard.php
  2. Copy the file and follow the instrcution
  3. Add follow lines to the end of php.ini to make it work with PHPStorm
[XDEBUG]
zend_extension = C:\xampp\php\ext\php_xdebug-2.5.4-7.1-vc14.dll
xdebug.remote_enable = true
xdebug.idekey = PHPSTORM
xdebug.remote_connect_back = true
xdebug.remote_port = 9000
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = 'c:\xdebug'   ---- create this directory----
    

Check the Xdebug profile snapshot in PHPStorm

  1. Add ?XDEBUG_PROFIL or &XDEBUG_PROFIL to the URL
  2. It will generate a file in c:\xdebug directory
  3. Open the file from previous step in PHPStorm from tools => Analyse xdebug profile snapshot

Debug code in PHPStorm

  1. In PHPStorm from run => web server debug validation => validate the web server
  2. Follow the exact link e.g. 127.0.0.1 or locolhost
  3. Add this to end of URL XDEBUG_SESSION_START=PHPSTORM
  4. Turn on listen for debugger connection - Icon like telephone on top right
  5. Hit the URL and it start the debug in PHPStorm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment