Check PHP files syntax for list of files on Linux

To check all PHP files syntax in current folders including subfolders you can use command like:

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

If you want to check few files syntax you can add them to some file e.g. /tmp/check-php-files-syntax.list and then run command below:

# for file in `cat /tmp/check-php-files-syntax.list`; php -l ${file}; done