To check the syntax of all files ending with ‘.php’ file extension and execute the syntax check of php for every found file, we can use:

find ./ -type f -name \*.php -exec php -l {} \;

It is quite useful when you want to quicly see if any php file in a project/bunch of files, contains a parse error. Note: This command is for Linux/ Unix based systems. This will not work on a Windows system.

2 Responses to “Check the syntax of multiple PHP files all at once”

  1. Sabarish Says:

    Good start Jayant!!

    for i in `seq 210 240`;do ping 192.168.1.$i | grep “from”;done

    will quickly help u ping a set of machines. Just thought might be useful to system admins like me ;)

  2. Jayant Gandhi Says:

    Thanks for the tip Sabarish.

Leave a Reply