Syntax check for PHP

Sometimes you just want to check the syntax in a PHP file without running it. For this the good people developing PHP made the -l option. To use:

php -l <filename>

This will check the syntax of <filename> file. If there are no errors you will get: No syntax errors detected in <filename>

Tested with PHP v5.1.6

Comments are closed.

Niklas Tech Blog
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.