How change the phpize to match the php version?

I have a php version of 7.1.1, and the phpize I installed by following the instructions from https://xdebug.org/wizard.php is like this,

Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012

when I searched about this, it is for php 7.0

Is there a way I can change this? I followed this instruction https://xdebug.org/docs/faq#custom-phpize but still not working.


Solution 1:

In Ubuntu 16 Vagrant box with multiple versions of PHP installed and having PHP7.1 as default. I ran the following commands:

sudo update-alternatives --set phpize /usr/bin/phpize5.6
sudo update-alternatives --set php /usr/bin/php5.6
sudo update-alternatives --set php-config /usr/bin/php-config5.6

Solution 2:

In my case

php -v showed version 7.2, and

php-config --version showed version 7.0


My solution was to run:

sudo apt-get install php7.2-dev

so that versions match


And now running php-config --version shows 7.2 properly

And running phpize shows:

Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718

(changed from 20151012 to 20170718)

Solution 3:

I found that running the specific version of phpize and php-config which matched the php version (7.2) solved my compilation issues:

$ /opt/cpanel/ea-php72/root/usr/bin/phpize
$ ./configure --enable-shared --with-php-config=/opt/cpanel/ea-php72/root/usr/bin/php-config