3

After installing a php application my site loads the app with a warning overlayed on the page

Warning: strftime() [function.strftime]: 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.

I believe the problem is that there is no timezone set in php.ini on this server. My server company doesn't think that this is something they should have configured when they set up the server, so how do I edit the php.ini file and what do I insert to get rid of this error.

2 Answers 2

5

Not sure about editing the php.ini file, but I always set the default time zone as part of a config include

<?php date_default_timezone_set('Europe/London'); ?>
1
  • thanks, it worked fine, but is that okay , dont we face any problem ?
    – profile 1
    Commented Dec 2, 2016 at 9:56
3

If you want to do the fix the problem in the php.ini, you can use date.timezone like:

date.timezone = "THETIMEZONE"

If you want to do in the php script, you can use the date_default_timezone_set function:

date_default_timezone_set("THETIMEZONE");

Here you can find the list of the Timezone: http://www.php.net/manual/en/timezones.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.