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
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
.
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.