Xdebug for php 7 on ubuntu 14.04

php-7phpizexdebug

I'm trying to get xdebug working on PHP 7. I'm build the xdebug.so file from version http://xdebug.org/files/xdebug-2.4.0rc4.tgz. The phpize output looks correct (Zend Extension Api No: 320151012) however I get Xdebug requires Zend Engine API version 220121212. from PHP.

So I've followed these instructions:

Tailored Installation Instructions

Summary

Xdebug installed: no Server API: Apache 2.0 Handler Windows: no Zend
Server: no PHP Version: 7.0.9-1 Zend API nr: 320151012 PHP API nr:
20151012 Debug Build: no Thread Safe Build: no Configuration File
Path: /etc/php/7.0/apache2 Configuration File:
/etc/php/7.0/apache2/php.ini Extensions directory:
/usr/lib/php/20151012 Instructions

Download xdebug-2.4.1.tgz Unpack the downloaded file with tar -xvzf
xdebug-2.4.1.tgz Run: cd xdebug-2.4.1 Run: phpize (See the FAQ if you
don't have phpize.

As part of its output it should show:

Configuring for: … Zend Module Api No: 20151012 Zend Extension
Api No: 320151012 If it does not, you are using the wrong phpize.
Please follow this FAQ entry and skip the next step.

Run: ./configure Run: make Run: cp modules/xdebug.so
/usr/lib/php/20151012 Edit /etc/php/7.0/apache2/php.ini and add the
line zend_extension = /usr/lib/php/20151012/xdebug.so Restart the
webserver

With the exception that I've installed php7.0-dev instead of php5 apt-get install -y php7.0-dev.

When I run the phpize command I get the following output:

Configuring for:

PHP Api Version: 20151012

Zend Module Api No: 20151012

Zend Extension Api No: 320151012

As expected. However when I run PHP I get:

Xdebug requires Zend Engine API version 220121212.

The Zend Engine API version 320151012 which is installed, is newer.

Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later
version of Xdebug.

I'm obviously doing something wrong somewhere! Any help on debugging the issue is very appreciated! 🙂

Best Answer

So I fixed this by using the apt-get package: apt-get install -y php-xdebug

This seems to install the correct xdebug.so file and everything is working!

Related Topic