This thread introduces some basic tips about configuring PHP and Apache to give useful information about Joomla bugs. Most installations of Apache and PHP will not, by default, give this information, but this can easily be changed. Why enable reporting? Because this information will indicate where PHP found a problem and helps us resolve the cause of the problem.
Your Current Settings
You may have error logging already. To check using Joomla!1.5 , in the administrator application select Help -> System Info. On the submenu, select PHP Information and search for error_log, error_reporting, and display_errors . Both the local and global settings are show, but it is the local settings that matter when working with Joomla. You should also note the Configuration File (php.ini) Path for future reference.
How to Change the Settings
As with anything there are many ways to enable PHP reporting of errors and warnings, and the tips below represent the way that I like to work. Suggestions are welcomed.
Using Apache's 2.0 virtual hosting I have several sites on my local system, each with their own log files. With these settings, all PHP errors are both displayed and logged to a file. The php_flag and php_value directives can also be placed in an .htaccess file if the webserver permits the overriding of options.
Code: Select all
CustomLog /var/www/domains/joomla/access_log common
php_flag display_errors on
php_value error_reporting 6143
php_flag log_errors on
php_value error_log /var/www/domains/joomla/php_log
One can also enable these settings in the php.ini file.
Code: Select all
error_reporting = E_ALL
;error_reporting = E_ERROR
display_errors = On
;display_errors = Off
... and so on
If you are working on your own computer ( localhost ), then changing the Apache or PHP configurations may be as simple as opening the configuration file, making the changes, saving, and restarting the webserver. Otherwise, you may or may not be able to make these changes depending on your hosting service, and you may want to contact their support team for advice. You may still be able to enable error reporting using an .htaccess file.
Watching the Log File
The log file can easily be watched using a utility called tail which comes natively with most *nix distributions, including Linux and Mac OS X. Windows users will need to install this utility ( cygwin or unxutils ). When used, the PHP log file will look something like this:
Toby-Patterson:html $ tail -f /var/www/domains/joomla/php_log &
[27-Mar-2007 22:36:35] PHP Notice: Trying to get property of non-object in /private/var/www/domains/joomla/html/components/com_content/helpers/content.php on line 347
[27-Mar-2007 22:36:35] PHP Notice: Trying to get property of non-object in /private/var/www/domains/joomla/html/components/com_content/helpers/content.php on line 339
PHP Configuration References:
Apache Configuration References:
http://httpd.apache.org/docs/2.0/mod/co ... owoverride
Again, this is merely an introduction and suggestions are welcomed.
Note to moderators: Please feel free to edit this post with additional suggestions or links.
--edit March 28th - links to cygwin and unxutils