1. Home
  2. Linux
  3. How to Install phpize in Ubuntu?

How to Install phpize in Ubuntu?

Question: I got an error phpize not found while installing PHP-SSH2 extension on Ubuntu. How to install phpize in Ubuntu?

Solution: How to install phpize in Ubuntu

phpize is a PHP command that helps to prepare an extension for compilation. It’s basically a shell script that makes an extension ready for compiling. For example, lets see how to compile and install PHP-SSH2 extension.

Download the ssh2 extension for PHP

$ wget https://github.com/Sean-Der/pecl-networking-ssh2/archive/php7.zip

Extract the extension archive as below

$ unzip php7.zip
$ cd pecl-networking-ssh2-php7

Do you find configure script inside the extension directory? In order to compile the extension you need configure script and that will be generated using phpize command.

If you don’t have phpize installed, then you can install it as shown below. phpize for PHP7 is bundled inside the PHP development package. So all you need is to install PHP development package.

$ sudo apt-get install php7.0-dev

 

Note

Remember to install the right PHP development package. Note the version appended to php in php7.0-dev. For PHP 7.1, the development package would be named as php7.1-dev.

Once installed, you will find phpize command inside /usr/bin directory.

$phpize

You might also find phpize7.0 command as well.

$phpize7.0

The phpize command should be executed at the top level of an extension directory and there should be a file named config.m4.

About config.m4

config.m4 file tells the UNIX build system about the configuration options, what external libraries and includes required and what source files are to be compiled as part of it. config.m4 file are written using autoconf syntax. Learn more about config.m4.

For example, to compile PHP-SSH2 extension, change the directory to the extracted extension folder and make sure config.m4 file is present. If present, then execute phpize command to get the extension ready for compilation.

$ cd pecl-networking-ssh2-php7
$ phpize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012

Now the extension is ready for compilation. Go ahead and run configure, make and make install to deploy the extension.

$ ./configure
$ make
$ make install

That’s it.

Updated on October 15, 2018

Was this article helpful?

Related Articles

Leave a Comment