Business Websites, Ecommerce solution, Process Automation!

How to Solve Codeigniter Time Zone error

  Posted in Codeigniter | 23rd December, 2017


How to Solve Codeigniter Time Zone error:

A PHP Error was encountered

Severity: Warning

Message: main(): 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

If you have not seen this error before in your Codeigniter code but suddenly started showing up, it means that you host may have upgraded to PHP 5.3 or later.

Other people have suggested making the following changes to the index.php:

if( ! ini_get('date.timezone') )




While that may work, I usually do not want to mess with base code.

To solve this problem,  a simple solution is to choose your Time Zone example 'America/New_York'

Add the following code to your config.php


Adding this to the Codeigniter configi.php ensures that all parts of your application will sync with this change.

If you are new to Codeigniter, config.php is located at /public_html/application/config


Build YourWebsites

Showcase your business online! Whether you need a website for your associations,business, ecommerce or affiliate marketing Call us Now

MaintainWeb Assets

Maintain Your Web Assets To ensure optimal performance and 99.9% uptime.We help you fix issues,on-page SEO optimization

Build NewAdd-ons

We help our Clients to add new features: Additional pages, add payment gateway, load products to your store or build a new e-commerce store.