From ThorstensHome
Revision as of 17:02, 12 December 2015 by ThorstenStaerk (Talk | contribs)

Jump to: navigation, search



It happens often that I see an empty page where I would expect something. One example is when I migrate a server and have a php script running on a new server. It may turn out that this new server does not have a specific PHP module and that is why it does not work. Similarly, if I forget a ";" at the end of a command, the whole php file will just show nothing in the browser. To troubleshoot this, change your php.ini file, e.g. /etc/php5/apache2/php.ini and make sure you have a line like

error_log = php_errors.log

Then you will find the php_errors.log file in the respective directory. For example if there is a problem with /var/www/ there will be a file /var/www/ telling you the errors as you are used to from command line:

[12-Dec-2015 15:34:16 UTC] PHP Parse error:  syntax error, unexpected '$NS' (T_VARIABLE), expecting ',' or ';' in /var/www/ on line 34


Here is a php trick that outputs debugging output when you want.

fwrite ($handler, "hello world");
fclose ($handler);

example for variables:

fwrite ($handler, var_export($variable,true));
fclose ($handler);

variables' content


To output an array use

echo serialize($array)

magic words