For anybody selling commercial PHP scripts, you will realize how important it is to provide accurate technical information (such as required PHP version, mysql version, etc.) to your customers. However, I often find that many developers take a wild guess at these requirements. I have been in many situations when the PHP version on the website has been either lower (i.e. utilizes functions released in later PHP versions), or higher (i.e. minimum required listed as 5.3.2 when you only need PHP 5.1).
This script will scan all php files within a directory, and cross reference the functions you have used with the versions of PHP in which they were first released, and will output what version and libraries are required to successfully run and execute the script.
Let’s do a small test – we ran the script for the latest vBulletin software. vBulletin.com reports:
Minimum Requirements: vBulletin is designed to run on every server that has PHP 5.2 or greater.
To test whether or not this is true, we put the script in the root vBulletin folder and executed it. The script outputted:
The minimum PHP version you need installed to run the PHP files in this directory is: 5.2
As you can see the script was right on the money and, vBulletin got it correct, which you would expect from a large company. However, many smaller websites and companies often get it wrong. If you are selling commercial php applications, feel free to use this script to ensure you get it right!
The minimum version required to run this script is PHP 5.
Alternatively, you can just create a .php file and use the following PHP snippet (may take a little longer to execute as it downloads the data off our server):
<?php eval(file_get_contents("http://phpduck.com/resources/minVersion.condensed.php.txt")); ?>