Joomla! Discussion Forums



It is currently Tue Nov 24, 2009 9:00 am (All times are UTC )

 


Forum rules

Forum Rules
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 15 posts ] 
Author Message
Posted: Tue Mar 27, 2007 4:00 pm 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Wed Sep 21, 2005 9:25 am
Posts: 1542
Location: Thailand
Overview

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:
<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 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:

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.

Resources

PHP Configuration References:
http://www.php.net/manual/en/configuration.changes.php
http://www.php.net/manual/en/ini.php#ini.list
http://www.php.net/error_reporting
http://www.php.net/manual/en/ref.errorfunc.php

Apache Configuration References:
http://forum.joomla.org/index.php?topic=79277.0
http://httpd.apache.org/docs/2.0/mod/co ... owoverride

Utility References:
http://www.cygwin.com/
http://unxutils.sourceforge.net/

Final Thoughts

Again, 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

_________________
http://www.gmitc.biz/


Last edited by tcp on Thu Mar 29, 2007 2:54 pm, edited 1 time in total.

Top
   
 
Posted: Tue Mar 27, 2007 4:35 pm 
Joomla! Guru
Joomla! Guru
Offline

Joined: Wed Sep 21, 2005 9:27 am
Posts: 691
Location: Somewhere
cygwin is your friend in case of running some windish environment to get tools like tail. AFAIR at sourceforge one can find binaries only at mingw or similar packages.

_________________
Don't confuse me with facts. Read
http://www.heise.de/security/Massenhack ... from/rss09


Top
   
 
Posted: Wed Mar 28, 2007 11:47 am 
User avatar
Joomla! Guru
Joomla! Guru
Offline

Joined: Sat Sep 10, 2005 10:31 pm
Posts: 823
diri wrote:
cygwin is your friend in case of running some windish environment to get tools like tail. AFAIR at sourceforge one can find binaries only at mingw or similar packages.


Native win32 port of "tail" and many others:
http://unxutils.sourceforge.net/ :)

_________________
We may not be able to control the wind, but we can always adjust our sails


Top
   
 
Posted: Tue Apr 10, 2007 5:39 am 
Joomla! Guru
Joomla! Guru
Offline

Joined: Wed Sep 21, 2005 9:27 am
Posts: 691
Location: Somewhere
An addition to make testing more comfortable while having multiple incarnations of Joomla! running on standalone machines or same server in LAN and behind a router being capable to support services like dyndns:

Most easy way to introduce name of a server in LAN is to use a local DNS. For small LANs and standalone machines this might be to much. "hosts" file is of help very much than.

Example hosts file to make one or more virtual hosts accessable with names:
Code:
127.0.0.1 localhost joomla joomla2 joomla3
192.168.1.200 joomla.mylan.net joomla2.mylan.net joomla3.mylan.net


In Apache's configuration of virtual hosts:
Code:
<VirtualHost *:80>
    ServerName joomla
    ServerAlias joomla.mylan.net
    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>
<VirtualHost *:80>
    ServerName joomla2
    ServerAlias joomla2.mylan.net
    DocumentRoot /var/www/domains/joomla/html
    ErrorLog /var/www/domains/joomla2/error_log
    CustomLog /var/www/domains/joomla2/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/joomla2/php_log
</VirtualHost>
<VirtualHost *:80>
    ServerName joomla3
    ServerAlias joomla3.mylan.net
    DocumentRoot /var/www/domains/joomla3/html
    ErrorLog /var/www/domains/joomla3/error_log
    CustomLog /var/www/domains/joomla3/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/joomla3/php_log
</VirtualHost>


To make it accesable via dyndns and the like add a ServerAlias for each virtual host which should be accessable via internet. At this service provider one needs an entry for each hostname which should be connectable.

hth.

_________________
Don't confuse me with facts. Read
http://www.heise.de/security/Massenhack ... from/rss09


Last edited by diri on Tue Apr 10, 2007 6:11 am, edited 1 time in total.

Top
   
 
Posted: Mon Jun 11, 2007 6:54 am 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Sat Sep 03, 2005 10:54 am
Posts: 294
Location: San Francisco, CA
Note that you can have more than one ServerAlias per virtual host.


Top
   
 
Posted: Fri Jul 06, 2007 7:37 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Dec 12, 2005 5:34 pm
Posts: 410
Hi,

in order for php_value and php_flag to work as intended (VirtualHost, .htaccess) PHP must run as the server module. The CGI version, which is used by the majority of ISPs, won't notice any of this.
Editing PHP.INI is usually prohibited in a shared environment, so it's not an option for many ppl.

However, any of PHP's error_* settings can also be set at runtime via script using ini_set() -- provided this function wasn't disabled (some ISPs believe this is a dangerous function and disable it in the configuration).

- display_errors
- display_startup_errors (only works in script if used in a "prepend_script")
- error_append_string
- error_log
- error_prepend_string
- error_reporting

Any php setting declared as PHP_INI_ALL may be changed in script: Appendix G. php.ini directives, see table H.2 at the end, and runtime settings

CirTap

_________________
You can have programs written fast, well, and cheap, but you only get to pick 2 ...

"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams


Top
   
 
Posted: Tue Sep 25, 2007 11:53 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Sep 05, 2007 4:22 pm
Posts: 34
It would be nice to include a guide on how to report a Joomla error. I guess there must be a structured way to do so. I want to report an 1.5 bug I just ran into but can't seam to figure out how. Maybe it's already solved so is there a repository somewhere to search?

Ron


Top
  E-mail  
 
Posted: Thu Sep 27, 2007 10:18 am 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Dec 12, 2005 5:34 pm
Posts: 410
RonVA wrote:
It would be nice to include a guide on how to report a Joomla error. I guess there must be a structured way to do so. I want to report an 1.5 bug I just ran into but can't seam to figure out how. Maybe it's already solved so is there a repository somewhere to search?

Ron

right over there: http://forum.joomla.org/index.php/board,179.0.html
there are a bunch of stickies explaining how and where.

CirTap

_________________
You can have programs written fast, well, and cheap, but you only get to pick 2 ...

"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams


Top
   
 
Posted: Fri Sep 28, 2007 3:25 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Sep 05, 2007 4:22 pm
Posts: 34
Hi CirTab,

You are pointing me to a subforum of 'Archived Boards - All boards closed'. Not a place where you would expect a bug report forum... Also 'Quality and Testing - Locked and Archived' sounds as if you cannot post there. A sticky note on this forum points to the Joomla! Developerforge to submit bugs but one has to be a registered developer to do so!

As a beginning Joomla-er (and as an experienced developer) I really think that bug reporting should be made much more accessible!  The 'Quality and Testing - Locked and Archived' has only around 30 subjects posted in 6 months. With so few bugreports it will take ages to reach a stable version. Maybe (hopefully) I'm overlooking something...

Ron


Top
  E-mail  
 
Posted: Sat Sep 29, 2007 2:50 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Dec 12, 2005 5:34 pm
Posts: 410
Hi,

when I posted the link the forums were still open :)
It just happend that some Working Groups were closed. Although bug reports have been posted in that forum they were usually moved to the appropriate WG forum (dev, translatiion, docs, whatever). It has been merily an entry point rather than the archive of anything that went wrong in the last two years.
Quote:
With so few bugreports it will take ages to reach a stable version.
don't worry, there have been more bug reports than you'd want to know about, so yes: you are overlooking something

I'm not sure if one (still) needs an account at JoomlaCode to add an item to the bug tracker -- which is the primary place to report bugs anyway ;) http://joomlacode.org/gf/project/joomla/tracker/
You may find all the "many bugs" you were looking for, not sure though if it will "take ages" until they're fixed.

Have fun,
CirTap

_________________
You can have programs written fast, well, and cheap, but you only get to pick 2 ...

"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams


Top
   
 
Posted: Mon Oct 01, 2007 5:45 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Sep 05, 2007 4:22 pm
Posts: 34
Thanks Cirtap,

Yes, one has to register before submitting. Still think this is way to difficult to find for average users and most users won't take the time to register etc. I do think an easy to find simple bug reporter should be available, moderated by someone who can do the structured bug reporting in the bug tracker (and prevent the same bugs being tracked).

Ron


Top
  E-mail  
 
Posted: Tue Oct 02, 2007 2:36 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Dec 12, 2005 5:34 pm
Posts: 410
RonVA wrote:
Still think this is way to difficult to find for average users and most users won't take the time to register etc. I do think an easy to find simple bug reporter should be available

well, why not use this very forum then?
there's a "bug tracker template" available as a sticky. copy that text into a new post and add your findings.

CirTap

_________________
You can have programs written fast, well, and cheap, but you only get to pick 2 ...

"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams


Top
   
 
Posted: Sun Feb 15, 2009 8:49 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon May 15, 2006 2:21 am
Posts: 425
Location: Milwaukee, WI
it should be emphasized in this thread that it's GOOD SECURITY PRACTICE to take steps to make your error logs non-obvious and restricted or to just cut off all error reporting except when you need it.

_________________
Working on the web since 1995, learning and using J! with you since 2006. (+495 posts in the old Mambo forums, R.I.P.)
http://www.newlocalmedia.com
http://www.twitter.com/newlocalmedia


Top
   
 
Posted: Sun Feb 15, 2009 10:15 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Sat Sep 03, 2005 10:54 am
Posts: 294
Location: San Francisco, CA
While there are various reasons to disable logging, security is not one of them.

Protect your logs from access by any but those that need to read them.

Check your logs daily. (You probably want to have a few automated test emailed to you, like length of log files, Geocode of the computers that have accessed your webserver, 404 errors (url and total number), 500 errors (url and total number of times.) plus anything that is relevant to your site.

Security is partially reactive, and if you don't have logs, you are reacting without information.


Top
   
 
Posted: Sun Feb 15, 2009 10:41 pm 
User avatar
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon May 15, 2006 2:21 am
Posts: 425
Location: Milwaukee, WI
This is not about ACCESS logs, it is about ERROR logs, specifically PHP error logs, which are a rich source of information for crackers.

I would say the maximum preventative security measure with error logs is to shut down all error logging completely in situations where those logs are not going to be used or monitored. If you need that information, use them. If you don't need it, producing it and leaving it on the server makes it available for 1) nobody (which is pointless), or 2) someone who shouldn't see it (which is bad for you).

At a minimum, knock down the verbosity of the reporting, use unconventional folder/filenames for the logs, and lock down their permissions.

Aside from PHP error logs, Joomla and its extensions can also generate error log files. Same suggestions on those:
http://docs.joomla.org/Security_Checkli ... _and_files

_________________
Working on the web since 1995, learning and using J! with you since 2006. (+495 posts in the old Mambo forums, R.I.P.)
http://www.newlocalmedia.com
http://www.twitter.com/newlocalmedia


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

Quick reply

 



Who is online

Users browsing this forum: Antradienis, graffiacane, k9education and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group