I don’t know since when but now in PHP I seem to be getting these blank pages when there is some type of syntax errors. If some of you ever had this problem it can be hard to find the missing semicolon or that extra parenthesis causing it.
Fist thing I checked was my php.ini configuration file.
#made sure all errors where being reported error_reporting = E_ALL & ~E_NOTICE #made sure errors where being displayed to page display_errors = On
Still no error showing up, so I checked my apache logs, nothing.
Then decided to check the syntax of my files using the php command line with the check syntax switch ( -l ) and bingo. The error was found, of course a simple semicolon that was forgotten in a file I had edited last night half asleep.
So here are a few examples of bash scripts that will check the syntax of your php files.
example 1: Using find command to check all PHP files from current directory
#!/bin/bash pwd=`pwd` for file in `find $pwd -name "*.php"`; do php -l $file; done;
example 2: Using subversion to check modified files
#!/bin/bash pwd=`pwd` for file in `svn status $pwd |grep -e ".*\.php$" | awk '{print $2;}'`; do php -l $file; done;
Instead of using subversion to check only modified you could use a timestamp as a point of reference then use one the find options to only check files modified after that time.
I tend to use Zend Server CE to track errors in the php stack. It logs it down to the line on which it occurs, and any error information that goes with it.