Knowledgebase

How to Change Server Timezone in cPanel?

You might assume that a different or wrong time zone is a spot of bother. But let us correct you there by saying it is not! This is the crux of the matter, especially for website owners. 

The inaccurate timezone on a server can lead to serious consequences, such as wrong or interrupted task scheduling. Log files and Email headers will have the wrong timestamps, which can cause difficulty in troubleshooting issues and identifying the correct time of receiving and sending an Email. 

The worst-case scenario would be expired SSL certificates. Every SSL certificate has an expiration date based on the server’s clock. Now, if your timezone is wrong, you may not get confused with the renewal date of the SSL certificate. 

All these situations will eventually lead to delayed work, additional efforts, trouble fixing issues, and, most importantly, site vulnerabilities against cyber attacks. 

To save yourself from such alarming causes, you must change the server timezone in cPanel. If you are unfamiliar with setting the timezone, continue reading this blog, as we will guide you on how to do so. 


Also Read: How To Change Your Website’s Content In cPanel?


Steps to Change the Server Timezone in cPanel

These steps will not only guide you to change the timezone in cPanel but also talk about setting the timezone in cPanel through the .htaccess file. Without further ado, let’s show you the steps. 

Step-1: Login to cPanel.

cPanel

Step-2: Once you log in, scroll down to find the ‘File Manager’ in the ‘Files’ section and click on it. 

File manager

Step-3: Scroll below in the file manager to search for ‘public_html.’ 

Select public html

Step-4: Upon opening the public_html, search for ‘.htaccess’ from the fetched records.

select htaccess option

In case you can’t locate the .htaccess file, head to settings in the top right corner of the file manager. 

search files

In the settings menu, tick the ‘Show hidden files’ option and click ‘Save’ to generate the hidden results.

select show and hide file option

Step-5: Right click on the .htaccess file when you find it and select ‘Edit’.

Select and click edit option

Step-6: You will see multiple strings of codes appears on your screen.

reopen file editer

Step-7: Add this below string of code to the top of the code in the .htaccess file. 

➔ Code:

php_value date.timezone ‘Asia/Kolkata

This is an Indian Standard Timezone, but you can change the code according to your timezone


Also Read: How to Install a PHP Script in cPanel?


Step-8: Click ‘Save Changes’ at the top right corner of the .htaccess file to save the last modifications.

click save changes

Step-9: Upon saving the changes, you will be redirected to the public_html page. Click on the ‘File’ at the top left corner of the file manager to create a new file. 

create new file

Step-10: Input the new file name. For instance, ‘newchanges.php’ and save it. 

make a new file

Step-11: Search for the new file in the public_html page and right-click on it. After that, click on the ‘Edit’ option to make changes. 

select edit option

Step 12: Input this string of the code at the top of the new file. 

➔ Code – 

<?php phpinfo(); 

echo “The time is “ . date(‘Y/m/d”) . date (“h:i:sa”);

? >

Finally, click on ‘Save Changes’ to save the modifications. 


Also Read: How to Create a PHPinfo File and View PHP Information?


Conclusion

Hope this knowledge-base blog helps you change the timezone in cPanel. If you are unable to change the timezone despite trying the above-given methods, consider checking for custom settings in the server’s PHP configuration. As possibilities of the custom settings hindering the process are high. 

In case the issue still remains unresolved, contact your hosting provider or system administrator for further assistance.