Reputation: 6274
I'm trying to add a custom error handler to my site, but in doing so have discovered that my webhost's PHP error reporting settings and those of my localhost (default XAMPP) vary considerably.
While I thought I was programming to E_STRICT like a good little boy, adding the error handler to my webhost revealed craploads of Runtime Notices. Example:
Runtime notice
strtotime() [function.strtotime]: It is not safe to rely on the system's timezone
settings. Please use the date.timezone setting, the TZ environment variable 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 'America/Chicago' for 'CST/-6.0/no DST' instead
In /home/...
Clearly this isn't a red-alert, showstopping error. But what bothers me is that it doesn't show up on my localhost. I'd certainly like to improve my code by addressing these sorts of issues if I could see them!
I've looked through both php.ini
files, and my webhost's setting is error_reporting = E_ALL & ~E_NOTICE
whereas mine was error_reporting = E_STRICT
, which I had thought was better. However, changing mine to match and rebooting the server doesn't seem to have accomplished anything.
Could someone please point me in the right direction?
EDIT - it seems I didn't make myself clear. I know how to solve the problem the notice is finding. MY PROBLEM is that my development PHP and my webhost's PHP are not throwing the same level of errors. The webhost is reporting these runtime notices while my testbed does not. And I don't know how to make my testbed show these errors.
Upvotes: 1
Views: 486
Reputation: 21947
date.timezone = "America/New_York"
date_default_timezone_set()
php_value date.timezone "America/New_York"
Of caurse, America/New_York
is example.
Upvotes: 1
Reputation: 157871
No, E_STRICT is already highest of them. Keep it.
Your PHP version on localhost is outdated. Upgrade it.
Then add date_default_timezone_set() to the application's config file to make correction of this error portable.
Upvotes: 0