Tuesday, July 19, 2016

Installing php7.0 with xdebug in Linux Ubuntu

First run these commands to install php 7.0 and all necessary libraries of php 7.0.

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
apt-get install php7.0-fpm php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-mysql php7.0-phpdbg php7.0-mbstring php7.0-gd php7.0-imap php7.0-ldap php7.0-pgsql php7.0-pspell php7.0-recode php7.0-snmp php7.0-tidy php7.0-dev php7.0-intl php7.0-gd php7.0-curl php7.0-zip php7.0-xml

After that, download stable release of x-debug extension.

wget -c "http://xdebug.org/files/xdebug-2.4.0.tgz"

Extract archive

tar -xf xdebug-2.4.0.tgz

Build extension

cd xdebug-2.4.0/
phpize
./configure
make && make install

Add following lines to /etc/php/7.0/apache2/php.ini config file

# Added for xdebug
zend_extension="/usr/lib/php/20151012/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_autostart=0
xdebug.remote_connect_back=0

Check whether xdebug is enabled from phpinfo().




No comments:

Post a Comment