Building a PHP Extension with a specific version

When building a native php extension it’s possible to run into problems when there are different php versions installed on the build system. As the extension is build with the php version / sources that are in the search path.

That is why “configure” allows to pass in a path to the php-config executable of the version /sources your are targeting. Run the configure for your extension like that:

./configure –with-php-config=[path to your php bin directory]/php-config

php-config returns all the necessary information so that configure is able to setup a valid makefile.