CodeIgniter on PHP 5.3
Last night I set up Zend Community Server with PHP 5.3 and gave PyroCMS (running CodeIgniter 1.7.2) a spin. Out of the box v0.9.7.3 and v0.9.8-dev seemed to work fine, except for a single Warning at the top of each page:
"warning: date(): 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."
To fix this, you only need to edit the main index.php for your CodeIgniter application:
/*
|---------------------------------------------------------------
| DEFAULT TIMEZONE
|---------------------------------------------------------------
|
| Set the default timezone for date/time functions to use if
| none is set on the server.
|
*/
if( ! ini_get('date.timezone') )
{
date_default_timezone_set('GMT');
}
This modification is something you will probably need to make for any CodeIgniter application running on PHP 5.3 and can easily be modified to your local timezone. There is a full list of supported timezones in the PHP manual here.
Another tweak that might be worth trying (although not something I had an issue with on my apps) will be removing error messages for deprecated functions. I personally would prefer to see these so I know what to fix, but if you are trying to fix an app running on PHP 5.3 quickly, change your error reporting level in index.php like so:
/*
|---------------------------------------------------------------
| PHP ERROR REPORTING LEVEL
|---------------------------------------------------------------
|
| By default CI runs with error reporting set to ALL. For security
| reasons you are encouraged to change this when your site goes live.
| For more info visit: http://www.php.net/error_reporting
|
*/
error_reporting(E_ALL & ~E_DEPRECATED);
Have you noticed any other problems when upgrading your CodeIgniter applications to PHP 5.3? If so (and the damn captchas are actually working...) please let me know in the comments.

Comments
2009-12-10
Good post Phil. I just ran across the timezone problem earlier this week.
This will also be a good post to point all the "AHHH MY CI IS BROKEN IN PHP5.3!" CI forum posters to.
Also, this captcha is wicked small; I'm going to have to zoom in...
Thanks,
2009-12-12
It would be quicker and cleaner to edit the php.ini file directly instead...
2009-12-14
@Nicolas Bui: Of course, but if you have no access to the php.ini it could be an issue.
That aside, I try to make my applications as portable as humanly possible. If someone downloads my application and see's an error, they assume the application is at fault and not their server. While it would be ideal if I could just say "just sort your server out" it's much easier to do things this way.
2010-04-02
Thanks, this definitely solved my problem really quickly...
2010-10-09
Thanks, It helped me a lot:D
2010-12-27
This solution did not work for me. I tried an alternate solution and that fixed the thing.
You need to simply put below line in your php.ini and restart the webserver.
date.timezone = "Asia/Kolkata";
Depending on your timezone you can modify it as suits you.
Enjoy!
2010-12-31
@Nirmal This solution works for installations that do not have access to their php.ini file (shared hosts and the like). If you have access to your ini file then you don't need to worry about it.
2011-01-25
Thanks, it worked for me!
2011-07-23
Thanks, solved my problem without any inconvenience
2011-07-25
This worked like a charm. Thanks for the info!
2011-07-29
Thanks a lot man, worked fine !
2011-09-19
Thanks, nice tutor
2012-04-26
Thanks Phill! You saved me a lot of time this morning!
2012-06-06
Thanks, but it didn't help until I put this in the View file:
putenv("TZ=Europe/Berlin");