Checking Syntax Error in PHP from Command Line
PHP allows you to check your script syntax without running the code. Just use the – l switch with php command. It will check the syntax error in your script and show the “Unexpected token …” error message if there is any syntax error in your script.
Here First we will create a php file “Hello.php”
- <?php
- echo “\n Hello PHP! \n”;
- ?>
Command to check syntax errors in your PHP script:
- $ php -l hello-world.php
Below is the screen that showing running php command with error messages.
Follow @phpzag


nice post!
better way to know HTMl markup, thanks..keep it up
really fantastic job…keep it up!