Setting the correct timezone for your website is essential for accurate timestamps in logs, user activities, scheduled tasks, and application functions. Configuring your PHP timezone correctly ensures all date and time functions align with your local or target region. With cPanel, you can easily configure PHP timezone for your site by editing the php.ini file or using the Select PHP Version interface, which is provided with your Domains.co.za Web Hosting account.
TABLE OF CONTENTS
Steps to Configure PHP Timezone via cPanel
Follow these steps to set or change your PHP timezone using the cPanel control panel.
1. Login to your Domains.co.za account.

2. Click on Manage Services on the left-hand side and select Web Hosting from the drop-down menu.
3. Click Manage next to your website’s domain name.

4. Scroll down to the Software and click Select PHP Version.

5. In the top right corner, click Options or Switch to PHP Options.

6. Ensure you choose the correct version and locate the date.timezone setting.
7. Click the current value (or blank field), and select your desired timezone from the dropdown list (e.g., Africa/Johannesburg).
8. Click outside the field or hit Enter to save your change.
9. The new timezone will apply immediately to all PHP scripts running on your website.
Additional Information
What is PHP?
PHP (PHP: Hypertext Preprocessor) is a general-purpose server-side scripting language used for web development. Unlike client-side languages like JavaScript (which runs in web browsers), PHP code is executed on the web server.
When a visitor requests a page, the server processes the PHP code, generates the HTML code, and then sends that HTML to the user’s browser. This enables the generation of dynamic content, database interaction, and more.
It can also be added directly to HTML files, making it easy to create dynamic web pages.
Why Change PHP Timezone in cPanel?
Changing the PHP timezone in cPanel is often necessary to ensure your PHP applications display and process dates and times correctly.
Many web applications like WordPress, ecommerce platforms, forums, and custom scripts use PHP to display dates and times for posts, comments, orders, user activity, etc.
If the PHP timezone for your website doesn’t match your intended or your visitors’ timezone, these dates and times will be incorrect, leading to confusion and a poor user experience. By changing the PHP timezone in cPanel, you are specifically instructing PHP to use your preferred one when handling date and time functions, ensuring your website functions correctly.
For example, if your server is in UTC (Coordinated Universal Time) but your users are in South Africa (SAST), a post made at 10:00 AM SAST would display as 8:00 AM UTC unless the PHP timezone is adjusted.
Best Practices To Configure PHP Timezone in cPanel
- Timezone Format: Use supported PHP timezone strings such as Africa/Johannesburg, Europe/London, or America/New_York. You can find the full list at PHP Supported Timezones.
- Affects PHP Functions: Functions such as date(), time(), strtotime(), and datetime() will use the new timezone once set.
- Default Timezone: If no timezone is set, PHP may default to UTC or the server’s global setting, which might not match your location.
- PHP Version Specific: Ensure you’re editing the timezone under the correct PHP version in use for your website.
- php.ini Alternative: Advanced users can manually edit the php.ini file (located in /home/username/public_html/), then restart Apache (or use the .htaccess method if allowed).
- CMS-Specific Timezones: Platforms like WordPress or Joomla have their own timezone settings. Set them within the CMS dashboard, even after setting the PHP timezone.
- Error Logs: If your PHP scripts generate warnings about undefined timezones, setting this value will resolve the issue.



