MoonPoint Support Logo


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals

Advanced Search
Sun Mon Tue Wed Thu Fri Sat

Sun, Jun 05, 2016 11:02 pm

Verifying PHP code from the command line

If you need to verify the PHP code in a .php file, you can do so from a command line interface (CLI), e.g., a shell prompt using the -l option; that's the letter "l", not the number "1". E.g., when I tried accessing a web page I had created, e.g.,, I saw only a blank page. If I examined the source code for the page in the browser from which I was viewing the page, there was nothing there. Looking through the PHP code, the cause of the error wasn't immediately obvious to me, but when I issued the command php -l somepage.php on the server where the page resided, the line that was causing the problem was identified.
$ php -l somepage.php
PHP Parse error:  syntax error, unexpected '$download_url_description' (T_VARIAB
LE) in somepage.php on line 79
Errors parsing somepage.php

Examining the code, I realized I had omitted a required semicolon from the prior line. When I added the semicolon at the end of the line and reran the check, I no longer saw any error messages and when I refreshed the webpage in the browser after making the update, it then displayed correctly.

[/languages/php] permanent link

Once You Know, You Newegg AliExpress by

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo