Compile PECL extension with phpize (multiple PHP versions)

April 2017 ยท 1 minute read

To compile a PECL extension with phpize we usually do:

$ cd extname
$ phpize
$ ./configure
$ make
# make install

But this could not work if you have multiple PHP installations on your Ubuntu server (i.e. 5.6, 7.0, 7.1).

To ensure the extension is installed only for a specific version you have to specify the correct version for the phpize and php-config binaries.

Example for version 7.0

$ cd extname
$ phpize7.0
$ ./configure --with-php-config=/usr/bin/php-config7.0
$ make
# make install

In this way the extension will be installed in the correct extension_dir folder.

Reference Links:

comments powered by Disqus