Info
Content

PHP Syntax Check


Ever had to make a change to a PHP file on the fly only to discover you made a syntax error? E.g. config.php in Moodle?

There’s an easy way to make sure you don’t have any syntax errors in your changes:

$ php -l config.php

Any syntax errors are reported on the screen.

NOTE: the check won't tell you what the error is, just that there is one e.g. Errors parsing config.php

If there are no errors you'll see:

No syntax errors detected in config.php
No Comments
Back to top