简体   繁体   中英

Determine minimum required PHP version

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 :-)

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.

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

I use (unit) tests for this purpose.

for v in $versions; do
  php$v -f tests.php
done

I don't think there is a tool for that. I guess you don't have to install all PHP version, try major releases, like 4.1, 4.2, 4.3, etc To my mind minor releases don't have language syntax changes or anything major, usually it's bug fixes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM