Linux/PHP one liner – Syntax check all files.
Here’s a simple one liner you can use to syntax check all php files in your working directory.
find . -type f -name "*.php" -exec php -l {} \; | grep -v 'No syntax errors'
For those not familiar with the programs used, it basically reads as…. Find all files that end in ‘.php’ and with each of those files run php -l. This is then put through a pipe to the grep -v, which filters out all files that are syntactically correct.
Tags: find, Linux, one liner, PHP, syntax check








January 15th, 2009 at 5:08 pm
This looks really useful. I’m getting a nofind on php though, where does this script come from?