Changing the time zone in your WHMCS installation ensures that all date and time functions align with your local time, which is crucial for accurate scheduling, billing, and record-keeping. This tutorial will guide you through setting the Eastern Standard Time (EST) by modifying the configuration.php file.

Prerequisites

  • Access to the WHMCS installation directory on your web server.
  • A text editor to modify files (e.g., Notepad++, Visual Studio Code).
  • Basic understanding of PHP and file management on servers.

Step-by-Step Tutorial

Step 1: Locate the Configuration File

The configuration.php file is typically located in the root directory of your WHMCS installation. Access this directory using your preferred method (FTP, cPanel File Manager, SSH, etc.).

Step 2: Backup the Configuration File

Before making any changes, it’s a good practice to back up the existing configuration.php file. This way, if something goes wrong, you can restore the original settings.

Step 3: Edit the Configuration File

  1. Open the File:
    Open the configuration.php file with your text editor.
  2. Modify the File:
    Add the following line at the top of the file, ideally after the opening <?php tag but before any other code:
   date_default_timezone_set('America/New_York');

This command sets the PHP environment’s timezone to Eastern Time, which automatically adjusts for Eastern Standard Time (EST) and Eastern Daylight Time (EDT).

  1. Comment on the Code:
    It’s helpful to add a comment before the line explaining why this change was made, especially if someone else might be managing the site in the future:
   // Set the default timezone to Eastern Time (America/New_York)
   date_default_timezone_set('America/New_York');

Step 4: Save and Close the File

After adding the line, save your changes and close the editor. Ensure that you upload the modified file back to the server if you’re editing it locally.

Step 5: Test the Configuration

To ensure the new setting is working as expected, create a simple PHP script in the WHMCS directory to output the current time:

  1. Create a New PHP File:
    Name it test-timezone.php.
  2. Add the Following Code:
   <?php
   echo "The current date and time in the configured timezone is: " . date('Y-m-d H:i:s');
  1. Open the File in a Browser:
    Navigate to http://yourdomain.com/test-timezone.php. Replace yourdomain.com with your actual domain. The page should display the current date and time in the Eastern Time zone.

Step 6: Clear Caches (if necessary)

If WHMCS or your PHP setup uses any caching mechanisms, clear these caches to ensure that the new setting is applied across the entire platform.

Conclusion

You have now successfully set the timezone for your WHMCS installation to Eastern Time. This will ensure that all date and time functions within WHMCS will use this timezone setting, which is crucial for scheduling tasks, billing cycles, and maintaining correct time records.

Always keep documentation of changes made to system files like configuration.php for future reference and troubleshooting.

Categorized in:

Web Hosting support, WHMCS,

Last Update: June 7, 2024