Setting up XDebug in Apache
First off, ensure that the modules have been installed for php and xdebug:
sudo apt-get install php5-dev php5-cli php-pear
sudo pecl install xdebug
Now the packages should be installed, we need to find the default location for PHP and xdebug. Take note of both resulting directories:
which php5
sudo find / -name 'xdebug.so'
Horrah, we have our paths for the xdebug plugin so we can edit the approrpaite PHP files. There are two exciting options here:
Number 1 – you can edit PHP ini directly and add the code (later)
sudo nano /etc/php5/apache2/php.ini
Number 2 – you can edit the conf.d/20-xdebug.so file and edd the code (later)
nano /etc/php5/apache2/conf.d/20-xdebug.ini
Code for PHP.ini or 20-xdebug.so:
# This should be the directory you received from the find command you used earlier
zend_extension = /usr/lib/php5/20121212/xdebug.so
# These settings enable a connection to sublime text.
# If you're using PHP storm you can use the same settings,
# with other programs mileage may vary
zend_extension=xdebug.so
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=1
Now it’s a good idea to restart apache so xdebug is loaded:
sudo /etc/init.d/apache2 restart
Setting up XDebug in PHPStorm
At this point you will need to open PHP Storm to configure it with Xdebug. Once it’s open go to:
File -> Settings
Select PHP from the left hand menu
click … on interpreter
hit the “reload” button and xdebug should appear.
Click ok.
click debug on left hand column
make sure xdebug options are enabled.
Bookmarks
You need to create new book marks in your web browser. You can either follow the guide at it’s source, or keep following what’s in the article:
http://www.jetbrains.com/phpstorm/marklets/
Start xDebug
javascript:(/** @version 0.5.2 */function() {document.cookie='XDEBUG_SESSION='+'PHPSTORM'+';path=/;';})()
Stop xDebug
javascript:(/** @version 0.5.2 */function() {document.cookie='XDEBUG_SESSION='+''+';expires=Mon, 05 Jul 2000 00:00:00 GMT;path=/;';})()
Debug this page
javascript:(/** @version 0.5.2 */function() {document.cookie='XDEBUG_SESSION='+'PHPSTORM'+';path=/;';document.location.reload();document.cookie='XDEBUG_SESSION='+''+';expires=Mon, 05 Jul 2000 00:00:00 GMT;path=/;';})()