user680244
user680244

Reputation: 155

XDEBUG installation reading wrong PHP version

I have an Ubuntu 16.04 vagrant box running on php 7.1. When I try to build xdebug by running ./configure in xdebug-2.6.0 I get

Check for supported PHP versions... configure: error: not supported. Need a PHP version >= 7.0.0 and < 7.3.0 (found 5.5.9-1ubuntu4.24)

PHP -v yields

Xdebug requires Zend Engine API version 320170718.
The Zend Engine API version 320160303 which is installed, is outdated.

PHP 7.1.15-1+ubuntu14.04.1+deb.sury.org+2 (cli) (built: Mar  6 2018 11:27:08) ( NTS )

So the system is running 7.1, but for some reason the configure script thinks we're still on 5.5.9

I've hit google pretty hard, but still can't find a way to update the Zend engine either.

Any ideas?

Upvotes: 2

Views: 2848

Answers (2)

Elvis
Elvis

Reputation: 1143

It happens because you're configuring with default settings and that is different from the PHP version you're trying to configure.

Just like you saw the PHP version using the php -v command, check the php-config version using the php-config --version command, it should be the same as php -v, but in your case, it would be different and hence this issue.

Now let's talk about how we can solve it. Since you need a different version of config, you should point that to the configure command.

For example, in your case, you need php-config7.1 (because you're using PHP v7.1, similarly for 7.2 you have php-config7.2 and so on)

To point the configure command to a specific PHP version you need to specify that as a flag called with-php-config and the value should be the location of the php-config file, a sample would be

./configure --with-php-config=/usr/bin/php-config7.1

Hope this solves the problem.

Upvotes: 11

kyriakos
kyriakos

Reputation: 1875

I assume you run phpize before running ./configure. Instead you need to run phpize7.1 and then ./configure

if you don't have phpize7.1 installed you can install it via:

sudo apt install apt install php7.1-dev

Upvotes: 2

Related Questions