How to install phpize for PHP 7+

Solution 1:

phpize for PHP7 is provided by the package php7.0-dev in Ubuntu 16.04. To install it open the terminal and type:

sudo apt install php7.0-dev  

phpize7.0 will be installed to /usr/bin/phpize7.0

To run it type:

phpize7.0

Example: get version of phpize7.0:

phpize7.0 -v

In Ubuntu 17.10 php7.0-dev has been updated to php7.1-dev and phpize7.1 will be installed to /usr/bin/phpize7.1 . In Ubuntu 18.04 php7.0-dev has been updated to php7.2-dev. In Ubuntu 20.04+ php7.0-dev has been updated to php7.4-dev. php7.4-dev is the current package in Ubuntu 21.04, and the php 8 package hasn't been released in the Ubuntu 21.04 default repositories, but the php8.0 package has been released in the 21.10 and later default Ubuntu repositories.

The phpize command is meant to be run at the top level of an extension source directory. This source directory should contain a file named config.m4. The config.m4 file for a PHP extension tells the UNIX build system what configure options your extension supports, what external libraries and includes you require, and what source files are to be compiled as part of it.

Solution 2:

To have command phpize on Ubuntu 16.04 and PHP7 install this package:

apt-get install php-dev