Skip to content

Instantly share code, notes, and snippets.

@matthewpoer
Last active June 27, 2016 05:40
Show Gist options
  • Save matthewpoer/198625ce601139d38c6c7530dd7496ba to your computer and use it in GitHub Desktop.
Save matthewpoer/198625ce601139d38c6c7530dd7496ba to your computer and use it in GitHub Desktop.
PHP Syntax Check. Checks the syntax using `php -l` for all PHP files in a directory. Only reports the errors and file names (i.e. doesn't show "No syntax errors detected in..."
find ./ -type f -name \*.php -exec php -l {} \; | grep -v 'No syntax errors'
@matthewpoer
Copy link
Author

To get just the current dir's php files:

ls -1 | grep '.php' | xargs -L1 php -l

@matthewpoer
Copy link
Author

Logging:

find . -type f -name \*.php -exec php -l {} \; > SyntaxCheck.log 2> SyntaxCheckFailure.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment