PHP command line syntax checking


Thanks to this bro for the post that help me find the syntax error inside my bunch of php code (http://www.electrictoolbox.com/php-command-line-syntax-checking/)

Syntax checking a single PHP file from the command line

The syntax for checking is like this, where the -l flag is a lower case L:
php -l filename

Syntax check all PHP files in the current directory

for i in *.php; do php -l $i; done

Syntax check all PHP files in the current directory and all subdirectories

find . -name \*.php -exec php -l "{}" \;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: