Check syntax of all PHP files, recursively

Here’s a one-liner to check/validate the syntax of all your PHP files at once. It simply runs php -l on all files with extension .php:

find . -type f -name "*.php" -exec php -l {} \; | grep -v 'No syntax errors'

Leave a Reply

Your email address will not be published. Required fields are marked *