Установка xdebug для php5.6 / Install xdebug for php5.6

18 октября 2018 г.

For Ubuntu <18.04:
sudo su
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install libapache2-mod-fastcgi php5.6-fpm php5.6 php5.6-dev php5.6-mcrypt php5.6-mbstring php5.6-mysql php5.6-zip php5.6-gd php5.6-xml php7.1-fpm libapache2-mod-fastcgi php7.1-fpm php7.1 php7.1-dev php7.1-mbstring php7.1-mysql php7.1-zip php7.1-gd php7.1-xml php7.1-curl php7.1-intl php7.1-json php7.1-mcrypt
apt-get install -f php-xdebug

Edit /etc/php/5.6/fpm/conf.d/20-xdebug.ini and add the lines:

xdebug.remote_host = localhost
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req

The xdebug part was a little bit tricky as we need to compile and build xdebug with a custom phpize version/php-config.

Different phpize and php-config versions on my local machine

Basically you can follow the instrcutions of the official Xdebug page: https://xdebug.org/wizard.php
BUT: when it comes to ./configure, you need to set the a different php-config.

  1. Download xdebug-2.5.2.tgz
  2. Unpack the downloaded file with tar -xvzf xdebug-2.5.2.tgz
  3. Run: cd xdebug-2.5.2
  4. Run: /usr/bin/phpize5.6.
  5. Run: ./configure --with-php-config=/usr/bin/php-config5.6
  6. Run: make
  7. Run: cp modules/xdebug.so /usr/lib/php/20131226
  8. Edit /etc/php/5.6/fpm/php.ini and add the line
    zend_extension = /usr/lib/php/20131226/xdebug.so
  9. Restart the webserver sudo server php5.6-fpm restart