Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do PHP releases match "API=yyyymmdd" signature/tag?

Is there a definite and reliable source to find out which PHP release version x.y.z carries/uses which "API=yyyymmdd" signature/tag?

like image 813
alk Avatar asked Dec 26 '22 12:12

alk


1 Answers

The version control repository of PHP is the authoritative source on the correlation between PHP releases and their API date-versions. Keep in mind that only major releases of PHP (e.g. 7.4) have a unique date-version.

new & improved

(for the lazy and irresponsible)

 curl https://gist.githubusercontent.com/tox2ik/8bafc9132fec4200312bc65005aec99c/raw/b7d921f157320b0cf451ae53577923bdf92801fc/ver.sh | bash

results in January 2021

$ time bash ver.sh 
php-4.0.3   19990421  4.0.3
php-4.0.6   20010119  4.0.6
php-4.2.3   20010901  4.2.3
php-4.4.9   20020918  4.4.9
php-5.0.5   20031224  5.0.5
php-5.2.17  20041225  5.2.17
php-5.3.29  20090626  5.3.29
php-5.4.45  20100412  5.4.45
php-5.5.38  20121113  5.5.38
php-5.6.40  20131106  5.6.40
php-7.0.33  20151012  7.0.33
php-7.1.33  20160303  7.1.33
php-7.2.34  20170718  7.2.34
php-7.3.27  20180731  7.3.27
php-7.4.15  20190902  7.4.15
php-8.0.2   20200930  8.0.2
time: Real 0m1.1s  User 0m0.8s  System 0m0.7s

script to run from the php git repo:

$ cat ver.sh 
git tag \
  | grep -Eo 'php-([0-9]+\.?){3}$' \
  | sort -ut. -k1.5,1n -k2,2n -k3,3n \
  | while read tag; do
  echo $tag `
  git show $tag:main/php.h | sed -n ' /#define PHP_API_VERSION /{ s///; p; q } '
  ` `
  git show $tag:main/php_version.h | sed -n " /#define PHP_VERSION /{ s///; s/[\"']//g; p; q } "
  `
done \
 | awk '{ ap[$2]=$0 } END { for (i in ap) { print ap[i] } }' \
 | column -t

remove the last awk part to list all x.y.z releases.


original answer below


(assuming bash)

Fetch PHP.

git clone https://github.com/php/php-src.git
cd php-src

list of relevant tags

tags() {
    git tag |
    sed -En ' /(RC|alpha|beta)/d ; /php-5/p ; ' | 
    sort -t. -k1,1n -k2,2n -k3,3n
}

some 270 log entries for main/php.h (where API version is defined).

go_crazy() {
    git log  main/php.h | 
    awk '/^commit / { print $2 }' | 
    tac
}

match relevant lines and remove cruft.

api() { 
    sed -n ' /#define PHP_API_VERSION /{
        s///; p; q } ' main/php.h
}

php_version () { 
    sed -n " /#define PHP_VERSION /{ 
        s///; 
        s/[\"']//g; 
        p; q 
    } " main/php_version.h
}

do the doo!

for i in `tags`
do
    
    git co -f $i
    echo $i `api`

done  > /tmp/tag.apis; 

for i in `go_crazy`
do
    
    git co -f $i
    echo `php_version` `api`

done > /tmp/many.versions

Results

$ awk '{ print $2, $1 }' /tmp/many.versions /tmp/tag.apis  | sort -u -k1,1
19990421 4.0pa1
20010119 4.0.5-dev
20010901 4.0.8-dev
20020307 4.3.0-dev
20020918 4.3.0-dev
20030518 5.0.0-dev
20030820 5.0.0b2-dev
20031103 5.0.0b3-dev
20031224 5.0.0RC1-dev
20041225 5.1.0-dev
20090626 5.3.0
20100412 5.3.99-dev
20121113 5.5.0-dev
20131106 5.6.0-dev
20131218 5.7.0-dev
 4.0pa1
 php-5.0.1b1

For the curious

Versions starting with php- are git tags and presumably official releases.

$ awk 'NF==2 { print $2, $1 }' /tmp/tag.apis /tmp/many.versions  | sort 
  
19990421 4.0.0
19990421 4.0.1
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.1-dev
19990421 4.0.2
19990421 4.0.2
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.2-dev
19990421 4.0.3-dev
19990421 4.0.4-dev
19990421 4.0.4-dev
19990421 4.0.5-dev
19990421 4.0.5-dev
19990421 4.0B1
19990421 4.0B2
19990421 4.0b2-dev
19990421 4.0b2-dev
19990421 4.0b2-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-dev
19990421 4.0B3-RC2
19990421 4.0b3-RC5
19990421 4.0b3-RC5
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-dev
19990421 4.0b4-rc1
19990421 4.0b5-dev
19990421 4.0b5-dev
19990421 4.0b5-dev
19990421 4.0b5-dev
19990421 4.0b5-dev
19990421 4.0b5-dev
19990421 4.0b5-dev
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0pa1
19990421 4.0RC1
19990421 4.0RC1
19990421 4.0RC2
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
19990421 4.0RC2-dev
20010119 4.0.5-dev
20010119 4.0.5-dev
20010119 4.0.5-dev
20010119 4.0.5-dev
20010119 4.0.5-dev
20010119 4.0.6-dev
20010119 4.0.6-dev
20010119 4.0.6-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010119 4.0.7-dev
20010901 4.0.8-dev
20010901 4.0.8-dev
20010901 4.0.8-dev
20010901 4.2.0-dev
20010901 4.2.1-dev
20010901 4.2.1-dev
20010901 4.2.1-dev
20010901 4.2.1-dev
20010901 4.2.1-dev
20010901 4.2.1-dev
20010901 4.3.0-dev
20010901 4.3.0-dev
20010901 4.3.0-dev
20010901 4.3.0-dev
20010901 4.3.0-dev
20020307 4.3.0-dev
20020307 4.3.0-dev
20020307 4.3.0-dev
20020307 4.3.0-dev
20020307 4.3.0-dev
20020307 4.3.0-dev
20020307 4.3.0-dev
20020307 4.3.0-dev
20020918 4.3.0-dev
20020918 4.4.0-dev
20020918 4.4.0-dev
20020918 5.0.0-dev
20020918 5.0.0-dev
20020918 5.0.0-dev
20020918 5.0.0-dev
20020918 5.0.0-dev
20020918 5.0.0-dev
20020918 5.0.0-dev
20030518 5.0.0b2-dev
20030518 5.0.0b2-dev
20030518 5.0.0-dev
20030518 5.0.0-dev
20030518 5.0.0-dev
20030518 php-5.0.0b1
20030820 5.0.0b2-dev
20030820 5.0.0b2-dev
20030820 5.0.0b2-dev
20030820 5.0.0b2-dev
20030820 5.0.0b2-dev
20030820 5.0.0b2-dev
20030820 5.0.0b2-dev
20030820 php-5.0.0b2
20031103 5.0.0b3-dev
20031103 php-5.0.0b3
20031224 5.0.0RC1-dev
20031224 5.0.0RC1-dev
20031224 5.0.0RC1-dev
20031224 5.1.0-dev
20031224 5.1.0-dev
20031224 5.1.0-dev
20031224 5.1.0-dev
20031224 5.1.0-dev
20031224 5.1.0-dev
20031224 php-5.0.0
20031224 php-5.0.0b4
20031224 php-5.0.1
20031224 php-5.0.2
20031224 php-5.0.3
20031224 php-5.0.4
20031224 php-5.0.5
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.0-dev
20041225 5.1.2-dev
20041225 5.1.2RC2-dev
20041225 5.1.3-dev
20041225 5.1.3-dev
20041225 5.2.0-dev
20041225 5.2.0-dev
20041225 5.2.0RC4-dev
20041225 5.2.1-dev
20041225 5.2.1-dev
20041225 5.2.1RC2-dev
20041225 5.2.1RC2-dev
20041225 5.2.5-dev
20041225 5.3.0alpha2-dev
20041225 5.3.0alpha2-dev
20041225 5.3.0alpha2-dev
20041225 5.3.0alpha2-dev
20041225 5.3.0alpha2-dev
20041225 5.3.0alpha3-dev
20041225 5.3.0alpha4-dev
20041225 5.3.0-dev
20041225 5.3.0-dev
20041225 5.3.0-dev
20041225 5.3.0-dev
20041225 5.3.0-dev
20041225 php-5.1.0
20041225 php-5.1.0b1
20041225 php-5.1.0b2
20041225 php-5.1.0b3
20041225 php-5.1.1
20041225 php-5.1.2
20041225 php-5.1.3
20041225 php-5.1.4
20041225 php-5.1.5
20041225 php-5.1.6
20041225 php-5.2.0
20041225 php-5.2.1
20041225 php-5.2.10
20041225 php-5.2.11
20041225 php-5.2.12
20041225 php-5.2.13
20041225 php-5.2.14
20041225 php-5.2.15
20041225 php-5.2.16
20041225 php-5.2.17
20041225 php-5.2.2
20041225 php-5.2.3
20041225 php-5.2.4
20041225 php-5.2.5
20041225 php-5.2.6
20041225 php-5.2.7
20041225 php-5.2.8
20041225 php-5.2.9
20090626 5.3.0
20090626 5.3.3-dev
20090626 5.3.3-dev
20090626 5.3.3-dev
20090626 5.3.3-dev
20090626 5.3.3-dev
20090626 5.3.99-dev
20090626 php-5.3.0
20090626 php-5.3.1
20090626 php-5.3.10
20090626 php-5.3.11
20090626 php-5.3.12
20090626 php-5.3.13
20090626 php-5.3.14
20090626 php-5.3.15
20090626 php-5.3.16
20090626 php-5.3.17
20090626 php-5.3.18
20090626 php-5.3.19
20090626 php-5.3.2
20090626 php-5.3.20
20090626 php-5.3.21
20090626 php-5.3.22
20090626 php-5.3.23
20090626 php-5.3.24
20090626 php-5.3.25
20090626 php-5.3.26
20090626 php-5.3.27
20090626 php-5.3.28
20090626 php-5.3.3
20090626 php-5.3.4
20090626 php-5.3.5
20090626 php-5.3.6
20090626 php-5.3.7
20090626 php-5.3.8
20090626 php-5.3.9
20100412 5.3.99-dev
20100412 5.3.99-dev
20100412 5.3.99-dev
20100412 5.3.99-dev
20100412 5.3.99-dev
20100412 5.3.99-dev
20100412 5.5.0-dev
20100412 5.5.0-dev
20100412 5.5.0-dev
20100412 5.5.0-dev
20100412 5.5.0-dev
20100412 php-5.4.0
20100412 php-5.4.1
20100412 php-5.4.10
20100412 php-5.4.11
20100412 php-5.4.12
20100412 php-5.4.13
20100412 php-5.4.14
20100412 php-5.4.15
20100412 php-5.4.16
20100412 php-5.4.17
20100412 php-5.4.18
20100412 php-5.4.19
20100412 php-5.4.2
20100412 php-5.4.20
20100412 php-5.4.21
20100412 php-5.4.22
20100412 php-5.4.23
20100412 php-5.4.24
20100412 php-5.4.25
20100412 php-5.4.26
20100412 php-5.4.3
20100412 php-5.4.4
20100412 php-5.4.5
20100412 php-5.4.6
20100412 php-5.4.7
20100412 php-5.4.8
20100412 php-5.4.9
20121113 5.5.0-dev
20121113 5.5.0-dev
20121113 5.6.0-dev
20121113 5.6.0-dev
20121113 php-5.5.0
20121113 php-5.5.1
20121113 php-5.5.10
20121113 php-5.5.2
20121113 php-5.5.3
20121113 php-5.5.4
20121113 php-5.5.5
20121113 php-5.5.6
20121113 php-5.5.7
20121113 php-5.5.8
20121113 php-5.5.9
20131106 5.6.0-dev
20131106 5.6.0-dev
20131106 5.6.0-dev
20131106 5.6.0-dev
20131218 5.7.0-dev
20131218 5.7.0-dev
20131218 5.7.0-dev
like image 98
Ярослав Рахматуллин Avatar answered Dec 28 '22 06:12

Ярослав Рахматуллин