Wednesday, 4 May 2011

Fix for my php probs!

After a few weeks of frustration, I've finally fixed up my thumbnail probs on my portfolio site - the fix was to do with the default timezone setting.

Thanks to Vamonos Software for the post that lead me to a solution for my prob (tho I did it slightly differently...)

Issue: Images were being generated in the timthumb cache, but not displaying on my site. Was convinced it was to do with caching/headers, I looked in my sites apache error log, and lo and behold I had been getting these errors:

[Sat Apr 30 09:52:05 2011] [error] [client] PHP 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 'Europe/London' for 'BST/1.0/DST' instead in /var/www/ on line 526, referer:

The fix was pretty simple - could either set the default.timezone in php.ini, or for me (better as I'm on a server with mutiple sites), add the following to the timthumb.php script in my wordpress theme, as the first line of function show_cache_file($mime_type):


Reset my wordpress page cache, and HURRAY, all is fixed!