OverviewThis 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 SettingsYou 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 SettingsAs 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:
<VirtualHost *:80>
ServerName joomla
DocumentRoot /var/www/domains/joomla/html
ErrorLog /var/www/domains/joomla/error_log
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
</VirtualHost>
One can also enable these settings in the php.ini file.
Code:
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 FileThe 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:
Quote:
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
This information is incredibly useful to developers because it indicates exactly where PHP detected a problem. Not all problems will result with additional entries in the log file ( poor code logic, JavaScript/Browser issues ), but most will.
ResourcesPHP Configuration References:
http://www.php.net/manual/en/configuration.changes.phphttp://www.php.net/manual/en/ini.php#ini.listhttp://www.php.net/error_reportinghttp://www.php.net/manual/en/ref.errorfunc.phpApache Configuration References:
http://forum.joomla.org/index.php?topic=79277.0http://httpd.apache.org/docs/2.0/mod/co ... owoverrideUtility References:
http://www.cygwin.com/http://unxutils.sourceforge.net/Final ThoughtsAgain, this is merely an introduction and suggestions are welcomed.
Happy Debugging,
tcp
Note to moderators: Please feel free to edit this post with additional suggestions or links.
--edit March 28th - links to cygwin and unxutils
_________________
Your solution for a single-page checkout on any website.
http://moolah-ecommerce.com