Skip to content

Commit bcfc7e1

Browse files
committed
[compile_php56.sh] Auto get the latest PHP 5.6 version
Signed-off-by: Jack Cherng <[email protected]>
1 parent 2ef8828 commit bcfc7e1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

general/web_server/compile_php56.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,23 @@ MEMSIZE_MB=$(free -m | awk '/^Mem:/{print $2}')
1616
#----------------#
1717

1818
bison_version="2.7.1"
19-
php_version="5.6.40"
19+
php_version="latest"
20+
21+
# get the exact latest 5.6 version number
22+
if [ "${php_version,,}" = 'latest' ]; then
23+
# get something like "5.6.40"
24+
php_version=$( \
25+
curl -s -k 'https://api.github.com/repos/php/php-src/git/refs/tags' | \
26+
python -m json.tool | \
27+
command grep -Pio 'php-5.6.[0-9]+((alpha|beta|rc)[0-9]*)?' | \
28+
uniq | \
29+
tail -1 | \
30+
# remove leading "php-"
31+
cut -b 5-
32+
)
33+
34+
echo "[*] The latest PHP 5.6 version is ${php_version}"
35+
fi
2036

2137
# such as "5.6.39" => "56"
2238
php_version_path=$(echo "${php_version}" | sed -r 's/^([0-9]+)(\.([0-9]+))?.*$/\1\3/g')

0 commit comments

Comments
 (0)