Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine minimum required PHP version

Tags:

php

I have to find out the earliest PHP4 version my code will run under (I already know it runs on PHP5 and on PHP 4.4.9 (the last PHP4 version -- included in MAMP).

Are there code inspection tools that will do this? Do I need to install each PHP version and see what happens :-)

like image 424
asdlkfjasdklf Avatar asked Dec 17 '09 21:12

asdlkfjasdklf


3 Answers

There is a PEAR package in the bartlett.laurent-laville.org channel for this: PHP_CompatInfo

Find out the minimum version and the extensions required for a piece of code to run

Examples could be found here.

Note: The original PEAR package is for PHP4 only, and is no longer maintained.

like image 113
powtac Avatar answered Nov 19 '22 23:11

powtac


Before you manually download and install various versions of PHP, try to download the XAMPP versions, that have the old php binaries packaged:

Download links on oldapps.com

like image 1
Dan Soap Avatar answered Nov 20 '22 00:11

Dan Soap


I use (unit) tests for this purpose.

for v in $versions; do
  php$v -f tests.php
done
like image 1
just somebody Avatar answered Nov 19 '22 23:11

just somebody