An easy way to test php syntax in shell
Go to your php project directory and type this:
find * -type f -name '*.php' -exec php -l {} 1> /dev/null \;
If it return nothing all is ok.
Written by Juan
Related protips
2 Responses

Alternative without sed: find . -type f -name '*.php' -exec php -l {} > /dev/null +
over 1 year ago
·

Thanks for your comment. I am a noob in shell but I prefer your method in the find, but i can't use the -exec option form more of one line, I need to continue using xargs. My new version of the command:
find * -type f -name '*.php' | xargs -I x php -l x 1> /dev/null
In the same way, if it not return nothing all is ok, but now if we have errors the output is better
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#