Yii 1.1: Syntax check



So I've been busy making lots of modifications to my views/models/controllers - came to test the app and got a blank screen. Nothing in the application.log file so must be a syntax error somewhere... But which file?


If you are using linux (Ubuntu in my case) and have php locally, then run the following from a terminal from the protected directory

find . -name \*.php -exec php -l "{}" \;

This will syntax check each php file recursively from the current directory.

Full credit to http://www.electrictoolbox.com/php-command-line-syntax-checking/

Total 2 comments

#3748 report it
Russell England at 2011/05/04 01:41pm

My mistake, I thought you needed Apache to run the php command tool :)

#3746 report it
Dudie Rirkx at 2011/05/04 01:28pm

I don't see how Apache is a requirement? Looks like pretty standard find and php... No Apache needed?

Leave a comment

Please to leave your comment.

Write new article
  • Written by: Russell England
  • Category: Tips
  • Yii Version: 1.1
  • Votes: +4 / -1
  • Viewed: 9,272 times
  • Created on: May 4, 2011
  • Last updated: May 4, 2011
  • Tags: php, syntax