Code Snippets and More

Xdebug is probably the most popular PHP debugger and profiler out there.

Installing and Configuring Xdebug

If you haven't installed it yet

pecl install xdebug

Verify your installation with

php -i | grep xdebug

Locate where's your php.ini

php -i | grep php.ini

Enable Xdebug remote control by apending to the php.ini file the next line


Configuring PHPStorm

Open the Debug Edit Configurations window then Run > Debug…

Click on Add New Configuration, select PHP Remote Debug, on the Configuration section click on the Servers select and create a new one. Fill the host to the application you want to debug, usually "localhost", the port and set the debugger to Xdebug. Once the server is added and back in the Configuration section, set the Ide key (session id) to your username. If you don't know, open a console and execute


Create the new configuration. Now you'll have a new option to debug under the Run menu. Execute your PHP application, and back in PHPStorm select Run > Debug 'Your new configuration'

Stablish some breakpoints in your code and refresh your application, voila!

Recent comments

© 2014 Copyright by Keyvan Akbary