Setting up phpStorm & Xdebug on a remote Ubuntu server

This will allow step by step debugging of code within phpStorm.

Install the xdebug package
sudo aptget install php5-xdebug

Create a new /etc/php5/apache2/conf.d/xdebug.ini file instead of adding to the /etc/php5/apach2/php.ini

Use the configuration below to build the ini file and update with your own values

; xdebug configuration
; build_date below needs to be replaced with the correct value
zend_extension=”/usr/lib/php5/build_date/xdebug.so”
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
; the ip address of the development machine that will be debugging
xdebug.remote_host=”192.168.1.101″
; 9000 is the default xdebug port
xdebug.remote_port=9000

Restart apache
sudo service apache2 restart

Check the installation
sudo php –version

xdebug-php-check

If you don’t see Xdebug then the path to xdebug.so is wrong in the /etc/php5/apache2/conf.d/xdebug.ini file

Finally check the values with phpinfo()

They should look like this

xdebug-php-info

xdebug-php-info-settings