Minimum PHP Version Calculator Script
Monday, March 29, 2010 11:24For 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")); ?>


Chris says:
March 29th, 2010 at 10:25 pm
I found this to be a very true post. I have noticed a few scripts I downloaded in the past where way off of the actual requirements. After looking over your code I found that it was very nicely put together, formatted, and well commented. Thank you for the script, hell I might just use it a few times ;P
Joan Miranda says:
April 26th, 2010 at 2:37 pm
Can I link to this webpage, from my web site? I’m wanting to gather as many snippets of useful information as I can.
Alex says:
April 27th, 2010 at 1:34 am
Yes, feel free to link to it.
Cameron Brennick says:
April 28th, 2010 at 4:52 am
cool stuff, cheers man
Ty Ledger says:
May 21st, 2010 at 10:15 am
Thank you very much for this script!