среда, 15 мая 2013 г.

Configure PhpStorm for debugging

Params:
IDE: PhpStorm6
OS: Ubuntu 12.10

Problem: 
Configure IDE for debugging.

Solution:
1) At first install and configure XDebug.


 My additional xdebug.ini options:
  • xdebug.remote_enable=On
  • xdebug.remote_host=localhost
  • xdebug.remote_port=9000
  • xdebug.max_nesting_level=250

Do not forget restart your web server with new configuration.
Also you can check if XDebug is used in phpinfo output.

2) Install and configure "Xdebug Helper" plugin in browser(chrome for example)
I using https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc
Configuration options for it:
IDE key Other:PHPSTORM1
Or you can try another key from PhpStorm documentation page:
http://www.jetbrains.com/phpstorm/marklets/

3) Configure PhpStorm:
Add your app server: File -> Settings -> PHP -> Servers (Debugger: Xdebug)
Configure debug options: File->Settings->PHP->Debug
  Xdebug | debug port - 9000
  Xdebug | Can accept external connections - checked


Debuging
Run->Break at first line in PHP scripts - check it
Run->Start Listen PHP Debug Connections - enable listener
Go to debugging page in browser.
Click on gray bug icon and enable Debug.
After these actions all should be ready, so reload page(or send a form, or click on link, ...) and debug will start.

Thanks to authors from these resources:
http://icephoenix.us/php/how-to-setup-local-php-debugging-with-phpstorm-and-xdebug/
http://blog.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/
http://blog.jetbrains.com/webide/2011/03/configure-php-debugging-in-phpstorm-2-0/