OJS3 error log - timezone settings and PHP Strict Standard

Hi everyone,
I am new and first timer here. My OJS3 runs well so far but I see the following errors being logged every second making the error log file to bloat to MB in size everyday. I do not know what to do with the errors. I am happy to let someone to log into my cpanel and correct it for me.

Please help!
Cheers!
Michael

[14-Mar-2018 21:26:09 UTC] PHP Warning: mktime(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in /home/neurosc1/public_html/ojs/lib/pkp/lib/adodb/adodb-time.inc.php on line 1073
[14-Mar-2018 21:26:09 UTC] PHP Strict Standards: Declaration of DRIVERDAO::setOAI() should be compatible with PKPOAIDAO::setOAI($oai) in /home/neurosc1/public_html/ojs/plugins/generic/driver/DRIVERDAO.inc.php on line 19
[14-Mar-2018 21:26:09 UTC] PHP Strict Standards: Declaration of CustomBlockPlugin::getSeq() should be compatible with BlockPlugin::getSeq($contextId = NULL) in /home/neurosc1/public_html/ojs/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 19
[14-Mar-2018 21:26:09 UTC] PHP Strict Standards: Declaration of CustomBlockPlugin::getBlockContext() should be compatible with BlockPlugin::getBlockContext($contextId = NULL) in /home/neurosc1/public_html/ojs/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 19
[14-Mar-2018 21:26:09 UTC] PHP Strict Standards: Declaration of CustomBlockPlugin::getEnabled() should be compatible with BlockPlugin::getEnabled($contextId = NULL) in /home/neurosc1/public_html/ojs/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 19
[14-Mar-2018 21:26:09 UTC] PHP Strict Standards: Declaration of CustomBlockPlugin::getContents() should be compatible with BlockPlugin::getContents($templateMgr, $request = NULL) in /home/neurosc1/public_html/ojs/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 19
[14-Mar-2018 21:26:10 UTC]

For the first error, I think it is enough if you add this to your config.inc.php https://github.com/pkp/ojs/blob/master/config.TEMPLATE.inc.php#L55

For disabling the strict standard errors, see error handling - Disabling Strict Standards in PHP 5.4 - Stack Overflow

1 Like

Hi ajnyga,

Thank you so much for your help. Both methods work and I no longer seeing the error being logged everytime the webpage is loaded or clicked on. Just to add on, I did have time set to “UTC” in the original config.TEMPLATE.inc.php file but I set it to a specific city to get rid of the error.

As of the strict standard error reporting, I put a line “php_value error_reporting 22527” in .htaccess file and no more error being logged so far.

Thank you!
Michael

1 Like

Hi ajnyga,

Today I received the following error, would you be able to help me with this?

[17-Mar-2018 23:22:53 UTC] PHP Warning: mktime(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in /home/neurosc1/public_html/ojs/lib/pkp/lib/adodb/adodb-time.inc.php on line 1073

That is probably related to a missing setting in your php.ini, see php - "date(): It is not safe to rely on the system's timezone settings..." - Stack Overflow. That is if adding the setting I mentioned above to config.inc.php does not work (note that you should not make the changes to config.TEMPLATE.inc.php)

1 Like

Hi Ajnyga

I have managed to solve the problem. I use

" date_default_timezone_set(‘Asia/Kuala_Lumpur’); " for /home/neurosc1/public_html/ojs/lib/pkp/lib/adodb/adodb-time.inc.php

and

if( ! ini_get(‘date.timezone’) )
{
date_default_timezone_set(‘Asia/Kuala_Lumpur’);
}

for index.php file.

The time zone setting has been resolved.

Thank you very much!
Michael

1 Like

which line did u add this code?

Hi @Emi_Naza,

I placed it here:


Fixed some more month problems due to gmt issues. Added constant ADODB_DATE_VERSION.
Fixed calculation of days since start of year for <1970.

  • 27 Jan 2003 0.02

Changed _adodb_getdate() to inline leap year checking for better performance.
Fixed problem with time-zones west of GMT +0000.

  • 24 Jan 2003 0.01

First implementation.
*/

/* Initialization */

/*
Version Number
*/
define(‘ADODB_DATE_VERSION’,0.35);
date_default_timezone_set(‘Asia/Kuala_Lumpur’);
$ADODB_DATETIME_CLASS = (PHP_VERSION >= 5.2);

/*
This code was originally for windows. But apparently this problem happens
also with Linux, RH 7.3 and later!

glibc-2.2.5-34 and greater has been changed to return -1 for dates <
1970.  This used to work.  The problem exists with RedHat 7.3 and 8.0
echo (mktime(0, 0, 0, 1, 1, 1960));  // prints -1

References:
 http://bugs.php.net/bug.php?id=20048&edit=2
 http://lists.debian.org/debian-glibc/2002/debian-glibc-200205/msg00010.html

*/

if (!defined(‘ADODB_ALLOW_NEGATIVE_TS’)) define(‘ADODB_NO_NEGATIVE_TS’,1);

function adodb_date_test_date($y1,$m,$d=13)
{
$h = round(rand()% 24);
$t = adodb_mktime($h,0,0,$m,$d,$y1);
$rez = adodb_date(‘Y-n-j H:i:s’,$t);
if ($h == 0) $h = ‘00’;
else if ($h < 10) $h = ‘0’.$h;
if ("$y1-$m-$d $h:00:00" != $rez) {
print “$y1 error, expected=$y1-$m-$d $h:00:00, adodb=$rez
”;
return false;
}
return true;
}


Cheers~

Hi @neuroscirn,

I’m not sure this post came through as you intended – try using the code quoting tool to make sure code snippets come through un-garbled.

Thanks,
Alec Smecher
Public Knowledge Project Team

Hello comunity,I need support, I have a OJS migrated to a shared hosting server , when I instaled all the files and databases, all work perfect, but creating a new number and trying uploads nwes files(pdf) OJS return this error (Warning: error_log(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in /home/alcentro/public_html/lib/pkp/classes/core/PKPApplication.inc.php on line 384) I check the sintaxis in the config.inc file and I think is correct:

time_zone = “UTC”

; Short and long date formats
date_format_trunc = “%m-%d”
date_format_short = “%Y-%m-%d”
date_format_long = “%B %e, %Y”
datetime_format_short = “%Y-%m-%d %I:%M %p”
datetime_format_long = “%B %e, %Y - %I:%M %p”
time_format = “%I:%M %p”

I’m, lost, please helpme https://www.nuevantropologia.org.mx
Regards in advance
Arturo

Hi @Arturo_Villegas,

You need to replace the “UTC” with the right timezone. For example, I used “Asia/Kuala_Lumpur”:

time_zone = “Asia/Kuala_Lumpur”

Cheers~