Set “date.timezone” option in php.ini

Today, I was trying to install the Zencart on my local system and getting this error "ERROR: date.timezone not set in php.ini. Please contact your hosting company to set the timezone in the server PHP configuration before continuing." According to the error it is clear that there is date.timezone is not set in my php.ini, Here is the solution to set the date.timezone in the php.ini file.

Step 1. Navigate to your php.ini file it should be /etc/php5/apache2/php.ini.
Step 2. Open the file in text editor.
Step 3. Search for the date.timezone and there should be ;date.timezone =. See the reference snapshot below:
Step 4. Remove the ; and put your time zone here just like as US/Arizona OR Asia/Kolkata or you can find the date time zone on
Step 5. Now the syntax will look like as date.timezone = “Asia/Kolkata”.
Step 6. Save and Close the file.
Step 7. Now restart the apache server by using the command /etc/init.d/apache2 restart

OR you can do it by using the command prompt:

1. Navigate to the folder location where is the php.ini file is and use the below command to open the file

nano php.ini

file will look like as the below screenshot

2. Now search for the date.timezone and edit it just like as the below:

date.timezone = “Asia/Kolkata”

as per the screenshot below



3. Now Press CTRL+X then Y and Enter;
4. Now restart the apache server by using the command /etc/init.d/apache2 restart

You have done now the problem has been gone. Thanks for reading and enjoy the coding.