How to set the PHP Api Version for phpize

Solved this one on my own -- installing php5-dev 5.3 gives you a phpize AND a phpize5. phpize5 has all the newest APIs. I'd still love to know how to get the default phpize to have that, though -- at least, without symlinking.


How:

phpize is a simple shell script and you can peer into what it is doing. When called with --version it does this. I've snipped out quite a bit for brevity.

prefix='/usr/lib/php5'
includedir="`eval echo ${prefix}/include`/php"
SED="/bin/sed"
..
PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|$SED 's/#define PHP_API_VERSION//'`
ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO//'`
ZEND_EXTENSION_API_NO=`grep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|$SED 's/#define ZEND_EXTENSION_API_NO//'`
..
echo "PHP Api Version:        "$PHP_API_VERSION
echo "Zend Module Api No:     "$ZEND_MODULE_API_NO
echo "Zend Extension Api No:  "$ZEND_EXTENSION_API_NO

The prefix variable at the top is hardset when PHP is compiled. /usr/lib/php5 is where my installation for that machine is. All phpize does is look at the header files for the installation at that prefix. I imagine that your phpize5 has a completely different path to phpize.

Why:

Perhaps your installation wants to differentiate between the older and newer versions, so has renamed one of them. It could be a result of having a 4.x release previously installed on the same machine.