Apache Error Log

drbowen wrote on Friday, June 10, 2005:

Have any of you guys looked at how many error codes OpenEMR throws into the Apache error_log after a vanilla install of OpenEMR?

It really generates a lot of errors from undeclared variables etc.

In fact it generates so many errors that in April the overfull Apache error_log crashed my Apache web server.  I fixed the problem by moving the error log to a new name and then recreating the usual error log.

This seems to happen with all my new installs.  Can we clean up the code so that these don’t occur on a vanilla install?

I have included a few examples for those so inclined.
________________________________________________

[Fri Jun 10 16:13:07 2005] [error] PHP Notice:  Undefined variable:  special_timeout in /var/www/htdocs/oemr/demo/openemr/interface/globals.php on line 84
[Fri Jun 10 16:13:07 2005] [error] PHP Notice:  Undefined variable:  tag in /var/www/htdocs/oemr/demo/openemr/interface/globals.php on line 102
[Fri Jun 10 16:13:07 2005] [error] PHP Notice:  Undefined variable:  backpic in /var/www/htdocs/oemr/demo/openemr/interface/globals.php on line 108
[Fri Jun 10 16:13:07 2005] [error] PHP Notice:  Undefined variable:  ignoreAuth in /var/www/htdocs/oemr/demo/openemr/interface/globals.php on line 123
[Fri Jun 10 16:13:07 2005] [error] PHP Notice:  Constant ADODB_FETCH_ASSOC already defined in /var/www/htdocs/oemr/demo/openemr/library/sql.inc on line 6
[Fri Jun 10 16:13:07 2005] [error] PHP Notice:  Undefined index:  auth in /var/www/htdocs/oemr/demo/openemr/library/auth.inc on line 7
[Fri Jun 10 16:13:07 2005] [error] PHP Notice:  Undefined index:  auth in /var/www/htdocs/oemr/demo/openemr/library/auth.inc on line 19
[Fri Jun 10 16:13:07 2005] [error] PHP Warning:  Call-time pass-by-reference has been deprecated - argument passed by value;  If you would like to pass it by reference, modify the declaration of [runtime function name]().  If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file.  However, future versions may not support this any longer.  in /var/www/htdocs/oemr/demo/openemr/library/freeb/xmlrpcs.inc on line 497
[Fri Jun 10 16:13:07 2005] [error] PHP Warning:  Call-time pass-by-reference has been deprecated - argument passed by value;  If you would like to pass it by reference, modify the declaration of [runtime function name]().  If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file.  However, future versions may not support this any longer.  in /var/www/htdocs/oemr/demo/openemr/library/freeb/xmlrpcs.inc on line 500
[Fri Jun 10 16:13:07 2005] [error] PHP Warning:  Call-time pass-by-reference has been deprecated - argument passed by value;  If you would like to pass it by reference, modify the declaration of [runtime function name]().  If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file.  However, future versions may not support this any longer.  in /var/www/htdocs/oemr/demo/openemr/library/freeb/xmlrpcs.inc on line 537

sunsetsystems wrote on Saturday, June 11, 2005:

Agreed, these should be fixed and it should not be difficult.  If someone who does not yet have CVS commit access wishes to do this, I can help get it checked in.

By the way you should be using something like logrotate to  do automatically with your web server logs what you did by hand.

– Rod <rod at sunsetsystems dot com>

drbowen wrote on Wednesday, June 22, 2005:

Currently OpenEMR generates around 270 lines of errors just to login.  Most of these errors are generated by some undefined variables  in globals.php.  Most of the pages read globals.php so we get around 400 errors per mouse click.  The great majority are large numbers of repetitions of the following undefined variables:

In openemr/interface/globals.php:

$special_timeout
$openemr_version
$backpic
$ignoreAuth
$encounter
$pid

The first three  are easy fixes.  I would like to propose the following declarations:

$special_timeout=3600;
$openemr_version = “”;
$backpic=’’;

The the following two lines also cause a bit of trouble (near line 102)  and I would like to propose the following changes:

$tag = ‘’; // release candidate 2

$openemr_version = "$v_major.$v_minor.$v_patch$tag";    // Version
_______________________________________________-

The variable

$ignoreAuth

affects the logic/security of globals.php and needs more careful study.  It was inserted here to prevent infinite looping.

globals.php at about line 126:

//include the authentication module code here, but the rule is
//if the file has the word “login” in the source code file name,
//don’t include the authenticatio module - we do this to avoid
//include loops
if (!$ignoreAuth) {
        include_once("$srcdir/auth.inc");
}

There are 6 files that set $ignoreAuth=true;

openemr/login.php
openemr/interface/login_screen.php
openemr/interface/login/filler.php
openemr/interface/login/login.php
openemr/interface/login/login_frame.php
openemr/interface/login/login_title.php

These 6 files initiate the process of authentication are are themselves exempted from authentication.  Most of the other files require $scdir/auth.inc.
__________________________________________________

$encounter
$pid

are undefined.
__________________________________________________

library/sql.inc begins with:

<?php

include_once(dirname(__FILE__) . "/sqlconf.php");
require_once(dirname(__FILE__) . "/adodb/adodb.inc.php");

define(‘ADODB_FETCH_ASSOC’,2);
$database = NewADOConnection(“mysql”);
$database->PConnect($host, $login, $pass, $dbase);
$GLOBALS[‘adodb’][‘db’] = $database;
$GLOBALS[‘dbh’] = $database->_connectionID;

Line 6 of sql.inc also generates a lot of errors.

define(‘ADODB_FETCH_ASSOC’,2);

Constant ADODB_FETCH_ASSOC already defined in /var/www/htdocs/openemr/library/sql.inc on line 6

Is there a way to rewrite line six of sql.inc without using this definition?

______________________________________________

Currently, my installation is generating 20 megabytes of errors per week.  This initial crash occurred after 15 months of operation when the error_log reached 2.1 gigabytes.

And yes, I could be log rotating apache/error_log, but this is not the stock behavior on slackware and I suspect a number of other distributions.  Having apache crash unexpectedly was not a happy experience for me.  Neither will it be for any new to intermediate users.  It would be better to prevent the problem by cleaning up the code.

drbowen wrote on Wednesday, June 22, 2005:

Could the phpGACL be used to solve this $ignoreAuth access problem without generating errors?

andres_paglayan wrote on Wednesday, June 22, 2005:

One way could be using a pear class.
http://pear.php.net/manual/en/package.authentication.auth.php

drbowen wrote on Thursday, June 23, 2005:

Adding another abstraction layer seems like it would introduce another level of complexity.

Using phpGACL needs to be introduced anyway.

If we defined a class of "registered users". Then placing the access control list at the beginning of the affected files would solve this problem and also serve as a built-in howto add ACLs for administrators new to OpenEMR.

drroller wrote on Friday, June 24, 2005:

I did a grep on all of my /var/log files and /var/log/httpd/, and didn’t find any of those example errors.

Mandrake comes out of the box with log rotation FYI.

You don’t have php 5 installed do you?

andres_paglayan wrote on Friday, June 24, 2005:

Most errors are PHP notices and warnings because of variables not being defined, which by the way, some say is a valid practice and a great advantage of php.
That’s another thing we should agree, if using or not undefined variables.
In my case, I use them in some functions to handle forms in a single way.
depending on the settings you may have in php.ini
those will or not be displayed, and/or logged.
Check arround line 300 of php.ini
Error handling and logging section.