PHP

From SME Server
Revision as of 11:48, 26 May 2007 by Cactus (talk | contribs) (Added content based on http://wiki.contribs.org/viewpost.php?p=156439)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

By default PHP does not display error messages on screen. Some times you get a blank page when executing PHP scripts. Usually some sort of error has occurred, but this error text will not be displayed as SME Server is configured to not display them. Instead the error messages are reported to the log files of the webserver and the general logfile of the server.

Try to analyze your logfiles: /var/log/httpd/error_log and /var/log/httpd/access_log and perhaps also /var/log/messages.


Warning.png Warning:
It is strongly advised to disable display errors after you have tracked and solved the problem, as the displayed error message might provide information (like filesystem layout) that only should be known to the system administrators and not to users, let alone people with bad intentions.


If you (for debugging purposes for instance) would like to enable it you can do it with the instructions found below:

mkdir -p /etc/e-smith/templates-custom/etc/php.ini
cp /etc/e-smith/templates/etc/php.ini/30ErrorHandling /etc/e-smith/templates-custom/etc/php.ini

After that:

cd /etc/e-smith/templates-custom/etc/php.ini
pico 30ErrorHandling

Modify the second line to read:

display_errors          = On

After that issue the following commands:

expand-template /etc/php.ini
/etc/rc7.d/S86httpd-e-smith restart

Now access your page again and see what the error is. If everything works you remove the 30ErrorHandling file from the /etc/e-smith/templates-custom/etc/php.ini folder and issue the last two lines again:

expand-template /etc/php.ini
/etc/rc7.d/S86httpd-e-smith restart