Main Content

Syntax checking in PHP

Archive - Originally posted on "The Horse's Mouth" - 2006-11-07 08:10:31 - Graham Ellis

If you want to check the syntax of your PHP page without actually running it, the -l option (that's lower case letter L) to PHP at the command line will do that for you:

wellho@lightning:~/public_html$ php -l index.php
No syntax errors detected in index.html
wellho@lightning:~/public_html$


Remember - even if you're developing code on a systems that's not your main server, you can install an Apache httpd and a PHP onto almost any systems for testing .... including the PHP command line.