[CentOS-devel] [PHP 5.2.6] API definition

Fri Mar 13 06:21:36 UTC 2009
Remi Collet <Fedora at FamilleCollet.com>

Paulo Martinez a écrit :

> It should be enough to specify Require/Provides-tags. As done in
> php-5.2.6-2.el5s2.src.rpm and php-mcrypt (src: php-extras) via
> 
>   %define apiver xxxxxxx
> 
> php-5.2.6-2.el5s2.src.rpm defines apiver 20041225.
> And here comes my question: It defines this ^^ ?
> 
>   rpm -q php-common-5.2.6-2.el5s2 --provides | grep api
>   php(api) = 20041225
>   php-api = 20041225

I saw ;
rpm -qp --provides php-common-5.2.6-2.el5s2.x86_64.rpm
php(api) = 20041225
php(zend-abi) = 20060613
php-api = 20041225

php(api) is not meanfull since it haven't chance for years (2004)
Only php(zend-api) is useful

php 5.1.x => 20050922
php 5.2.x => 20060613
php 5.3.x => 20090115


> 
> so far on rpms site. But
> 
>   php -i | grep -P 'PHP API|PHP Version'
>   PHP Version => 5.2.6
>   PHP API => 20041225

Check "phpize -v" :
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519


> 
> contrary to above log errors (API=20060613).

Exactly what I write above. "PHP Api Version" as no sense as the php
extension loader check the "Zend Module Api No"

> 
> Anyway, it explains why ex. php-mcrypt did't bleated at
> installation time about different APIs - it was satisfied.
> 
> 
> php-mcrypt (src: php-extras) define apiver on compile time
> 
> %global apiver	%((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API  
> => //p') | tail -1)

Should use (simpler) %php_core_api and %php_zend_api from
/etc/rpm/macros.php.

Generally Fedora package use something like :

%global php_apiver  %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API
=> //p') | tail -1)

%if %{?php_zend_api}0
# For php 5.2.x use macros from /etc/rpm/macros.php
Requires:     php(zend-abi) = %{php_zend_api}
Requires:     php(api) = %{php_core_api}
%else
# Poor check for older PHP
Requires:     php-api = %{php_apiver}
%endif


+