If I run phpize -v then I get

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

If I open phpinfo then it shows a newer date

enter image description here

so my phpize is outdated.

This is the output of php -v:

PHP 7.4.21 (cli) (built: Jul  1 2021 16:09:41) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies

If I create a php info page and show it, then it shows PHP Version 7.4.21 too

How can I get phpize for php 7.4 ?

  • 1
    From what you posted, it looks like you have multiple versions of PHP. The PHP on the cli is a different version than what you have running under your web server. You should be able to find the correct version of phpize was installed with the different version of PHP, but you have not described how PHP was installed so I am unable to point you to where it would be. Commented Sep 1, 2021 at 16:25
  • No, if I run php -v then I get PHP 7.4.21, if I open a phpinfo site then I get PHP 7.4.21 too, see my updated question please.
    – Black
    Commented Sep 2, 2021 at 8:48

4 Answers 4


To show all installed phpize versions installed using conformant packages on a debian-like system:

sudo update-alternatives --config phpize

You will see list of phpize versions

root@my-server:~# sudo update-alternatives --config phpize
There are 3 choices for the alternative phpize (providing /usr/bin/phpize).

  Selection    Path                     Priority   Status
* 0            /usr/bin/phpize.default   100       auto mode
  1            /usr/bin/phpize.default   100       manual mode
  2            /usr/bin/phpize8.1        81        manual mode
  3            /usr/bin/phpize8.2        82        manual mode

Press <enter> to keep the current choice[*], or type selection number:

Hit required number.

PS: You have to install phpize for the different versions of PHP for it to appear above. To install for PHP 8.1 run sudo apt-get install php8.1-dev


Figured it out.

First I searched for php7:

apt-cache search php7.4

then I found php7.4-dev and installed it:

sudo apt install php7.4-dev

This installed phpize7.4 in /usr/bin

The last step is to set phpize to the new version with:

sudo update-alternatives --set phpize /usr/bin/phpize7.4

Now phpize -v outputs:

Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
  • 1
    Note to myself: I also had to update php-config to php-config7.4
    – Black
    Commented Sep 2, 2021 at 10:17

I had some issues too compiling a module for a specific version of php : I have 7.4, 8.1, 8.2 and 8.3 installed, 8.3 was default, I needed to compile for 8.2

Setting default version for php and phpize was not enough I had to adjust it for the three executables :

sudo update-alternatives --set php /usr/bin/php8.2
sudo update-alternatives --set phpize /usr/bin/phpize8.2
sudo update-alternatives --set php-config /usr/bin/php-config8.2

If only setting the phpize alternative, it would display the right "PHP Api Version" at first, but when executing the ./configure there would be a line pointing to the wrong libraby versions. Setting the php-config right alternative would fix the issue.

Thanks to the previous answers to this post I was able to identify all required update-alternatives so I sum them up in one post

  • Thanks. I was having the exact same issue under Ubuntu 24.04 and getting very frustrated; like you, I have 7.4, 8.1, 8.2 and 8.3, and I need them all to use ImageMagick 7, which is not yet supported by Ubuntu 24.04, so it requires manual compilation... for all versions. Commented Jun 21 at 9:55

You also might need to change ./configure version :

./configure --with-php-config=/usr/bin/php-config8.1 [...]


I had to compile a php module for php8.1 while I had many php version installed (8.0, 8.1, 8.2). So my main version was 8.2 and the module was not compiled correctly (for 8.2 instead of 8.1). Anyway, this does not answer author question, but it might help some people who met the same issue and are in the same case as me.

  • I don't see how this answers the question.  Can you explain?  Please do not respond in comments; edit your answer to make it clearer and more complete. Commented Dec 24, 2022 at 1:51
  • Also, if this is an addition to the other answer, consider an edit there.
    – nohillside
    Commented Dec 24, 2022 at 6:37
  • This seems to be the start of an instruction to compile phpize from scratch, which isn't even remotely what the question asked about. Commented Aug 17, 2023 at 8:05
  • I had to compile a php module myself. So I met the same problem as the author. In addition to set a version to phpize, I also had to set a version to next step of building my module : set a version to php-config in the configure command. This does not answer author question, but it might help some people who met the same issue in the same case as me. Commented Aug 24, 2023 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .