**This is an old revision of the document!** ----
====== Install Xdebug ====== When it comes to PHP programming having the possibility to use a debugger to track problems in your code is a necessity. One of the most popular one in the PHP ecosystem happens to be [[http://xdebug.org|XDebug]]. ===== XDebug With Phpfarm ===== When using Phpfarm, XDebug has to be installed separately for each version. Hereunder are the explanation on how to do this, you'll have to repeate the process for each version of PHP you've installed. Quite obviously, you'll have to adapt the version number in the examples to fit your situation. ===== Getting the package ===== XDebug can be [[http://xdebug.org/download.php|downloaded in a variety of versions]] or even built from [[https://github.com/derickr/xdebug|sources]]. But the Xdebug website also offers an [[http://xdebug.org/wizard.php|installation wizard]] that will help determine what to do to get XDebug working on your system. Follow the simple instructions and you'll soon have XDebug installed and running. <code> mkdir /opt/phpfarm/xdebug cd /opt/phpfarm/xdebug wget http://xdebug.org/files/xdebug-2.2.3.tgz tar -xzf xdebug-2.2.3.tgz cd xdebug-2.2.3 </code> This is where the fact that we're using phpfarm slightly changes from the XDebug wizard's advices. As we need to use the correct phpize version to prepare XDebug, instead of "simply" typing phpize, we'll specify the full path of the phpize version to use: <code> /opt/phpfarm/inst/bin/phpize-5.5.7 Configuring for: PHP Api Version: 20121113 Zend Module Api No: 20121212 Zend Extension Api No: 220121212 </code> Also a little different from the wizard, as we have various versions of PHP installed, we need to explicitly set the configuration file to use: <code> sudo ./configure --with-php-config=/opt/phpfarm/inst/bin/php-config-5.5.7 sudo make sudo make install </code> Back to following the wizard: <code> sudo cp modules/xdebug.so /opt/phpfarm/inst/php-5.5.7/lib/php/extensions/debug-non-zts-20121212 </code> Finally we need to edit the **/opt/phpfarm/inst/php-5.5.7/lib/php.ini** file to activate the XDebug extension, adding the following lines at the end of the file: <code> sudo nano /opt/phpfarm/inst/php-5.5.7/lib/php.ini ----- add this at EOF ----- zend_extension="opt/phpfarm/inst/php-5.5.7/lib/php/extensions/debug-non-zts-20121212/xdebug.so" xdebug.profiler_output_dir = "/tmp/xdebug" xdebug.trace_output_dir = "/tmp/xdebug" xdebug.remote_enable=1 xdebug.remote_port=9000 xdebug.idekey=PhpStrom xdebug.remote_connect_back=1 ; additional settings ;xdebug.dump_globals=on xdebug.collect_params=4 xdebug.collect_vars=on xdebug.show_local_vars=on </code> === Restart apache service === You simlply have to restart the apache service to have XDebug available with this version of PHP... <code> service apache 2 restart </code> ===== Testing your XDebug ===== To make sure XDebug is working, you can check the phpinfo(); output that you initialy used to feed the wizard. Reloading the page should now contain an "xdebug section".