Syntax Check a PHP Pgm

May 14, 2010

Using the syntax checker built into php

Be sure your error reporting is turned on: (for your testing copy or for your IP address)
@ini_set('display_errors', '1');
error_reporting(E_ALL ^ E_NOTICE);

If it is and you still get nothing but a blank page … then, by all means, your next step might be to take the syntax check option built into PHP!
From a linux/unix command line (terminal session), run php with its (L)”lint” {l} option:
$   php -l [your-program-name.php]
ex: php -l index.php
alternately, Alan Dix has created a page where you can upload your program and his page will run the lint option on it for you and display it: php-syntax-check at Alan Dix’s MeanDeviation.com web site

to run a php script from a command line,

$ php [php-script.php]
where [php-script.php] is the name of your program.

Leave a Reply

We try to post all comments within 1 business day