Oct
20
PHPCheck released: PHP environment test tool
Filed Under Open Source, PHP - October 20th, 2006 10:54pm
A confession: it’s been over a year since I wrote this bit of code, with the intention of making it available to all and sundry. Clearly I haven’t had quite the time that was required to build a page and post it up on the web somewhere, but now I’ve got this blog going again I may as well put it here.
PHPCheck is a simple script which checks the PHP environment it’s running under for a set of minimum requirements defined in a configuration file. It’s ideal for use in installers but could easily be executed at run-time for any other software to ensure the environment hasn’t changed since it was last checked.
The format of the INI configuration file is simple and documented. Configuring it is straightforward once you know your requirements:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | [php] version = "4.3.0" [ini] allow_url_fopen = On safe_mode = Off max_execution_time = 15 upload_max_filesize = 1M short_open_tag = Off memory_limit = 10M error_reporting = E_ALL log_errors = On display_errors = Off magic_quotes_gpc = Off [filesystem] files = "phpcheck.ini,myfile.php" readable = "phpcheck.ini" writable = "phpcheck.ini,/etc,/tmp" directories = "/etc,myconfigdir" includes = "config.inc.php" pear = "DB,Log,HTML_Common,HTML_QuickForm" [declared] classes = "DB,exception,mysql,directory" functions = "trim,mysqli_connect" extensions = "gd,ming,mysql,mysqli" |
The INI file in the distribution includes comments describing each of the configuration directives. It’s all quite easy to set up.
There were a few additions I’d planned to make such as providing a simple interface for other code, and checking versions of modules/extensions. Perhaps now that I’ve posted it here that’ll provide the motivation to get on and do that! If you find the script useful please let me know.

Wow … do my eyes really see this? I must be still dreaming - is it really LIVE!!
This is a great bit of code dude …. good to see it finally shared with the world