With recent upgrade of a great number of servers to PHP 5.3.8 may clients reported that their site began to show error messages like
My first reaction was to suppress these Warnings by tweaking the error message level (from Joomla 1.5.20 and up you can do this simply by changing a setting in Global configuration, previously a .htaccess or php.ini directive was needed. But I decided to dig on, and find out why these warnings are issued. OK, from PHP 5.3 upwards these warnings should be common for similarly built sites, but there must be another factor too, because I found, that it's more server related. In some servers all - or most of - sites began to show the error, on others none of them.
Probably some server teams have better understanding of how you should set up the hosting environment... and you need to do the dirty job. Let's make long story short: you can solve the problem by manually setting the timezone in a local php.ini file or your .htaccess file, if your hoster let you do that. (If no, you will know instantly: you will got a nice "500 Internal Server Error: Operation forbidden" or something similar.) You need to use one or another, using both is overkill (and generally one or another method is forbidden by the hosting company.) So, let's see the .htaccess version first. Locate your .htaccess file - or if you don't have already one, create in your WEBROOT one, and place anywhere in your file the following:
php_value date.timezone Europe/Paris
Of course Europe/Paris is only an example, you need to find your timezone. The setting for php.ini is fairly similar. Again, you need to locate your local php.ini, if exist, or create a new one in WEBROOT folder, and place here the following lines:
[Date] ; Defines the default timezone used by the date functions date.timezone = "Europe/Brussels"
Test it by checking your site's frontend. You can see one of following situations:
- Nothing changed - your hoster uses a setting which are ignoring local php.ini files and/or PHP directives in .htaccess file. Then the solution is to try to adjust your error reporting level, and suppress the error, or give them a call.
- You see the infamous
- Everything is OK. You have to enjoy your site. ASAP.