I get a warning about "strtotime" in my PHP script

Some users have been receiving warnings similar to this recently:

Warning: strtotime() [function.strtotime]: 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 'UTC' for 'UTC/0.0/no DST' instead in /home/user/public_html/script.php on line 56

Our servers now run PHP 5.3, which now provides this warning if it detects that the date.timezone setting in the php.ini file isn't set correctly. While we do have this set on the server, some users have custom php.ini overrides. If you're receiving this error, check if you have a file called php.ini in your script's directory. You'll need to add the following line to it:

date.timezone = UTC

If this doesn't work, or you're uncertain how to go about modifying this file, please submit a support ticket and we can look into the issue for you.

  • 703 Users Found This Useful
Was this answer helpful?

Related Articles

What version of PHP and MySQL do you run?

We currently have several versions of PHP available, using the cPanel "MultiPHP" functionality,...

I'm getting memory limit errors in my PHP script

If you are receiving errors of the form "Fatal error: Allowed memory size exhausted" or similar...

I get an "Internal Server Error" on my PHP script!

Our servers use the suPHP method of executing PHP scripts. For security reasons, suPHP requires...