Menu

#2132 Problem with error_log in v1.9 on Windows/IIS

open
nobody
1
2020-08-18
2020-08-18
Elistia
No

I have just upgraded from v1.8 to 1.9

I was having some problems with LDAP authentication and was receiving a 'user unknown' error. However, when setting $ldap_debug = true I started receiving a HTML 500 response instead.

It turns out this was occuring for every call to error_log();

Eventually tracked the issue down to the following code in init.inc

// If the error log file is a relative path then turn it into an absolute one in
  // order to avoid problems in shutdown when the working directory can change.
  // (See the notes in https://www.php.net/manual/en/function.register-shutdown-function.php).
  $error_log = ini_get('error_log');
  if (isset($error_log) &&
      ($error_log !== '') &&
      (strpos($error_log, DIRECTORY_SEPARATOR) === false))
  {
    ini_set('error_log', getcwd() . '/' . $error_log);
  }

My error_log in php.ini is set to e:/logs/php/php_errors.log (note the unix type seperators which are valid here and work fine).

The use of DIRECTORY_SEPARATOR (which on Windows is '\') means that MRBS tries to reset my error_log to E:\websites\MRBS-1.9/e:/logs/php/php_errors.log which clearly causes an issue when an error is subsequently logged.

Is is absolutely necessary to override the log file location here? If it is, could both types of directory seperator be checked for?

Thanks.

Discussion

  • Campbell Morrison

    Thanks. Now fixed in f8c257.

    Mail sending has now been moved to a queuing model where the queue is emptied on shutdown. This was done so that the queue can be managed better and throttling implemented if your mail server imposes a rate limit. (It also makes it easier to empty the queue using a cron job, which can improve the perceived performance for the user). As a result any errors in mail sending, and mail debug messages, get completely lost if you have a relative path for error logging, which is the default on many systems. So I think it is necessary to change the log file location, but the code now checks for the absence of both Windows and Unix separators.

     

    Last edit: Campbell Morrison 2020-08-18
  • Elistia

    Elistia - 2020-08-18

    many thanks - that's working fine for me now :-)

     
MongoDB Logo MongoDB