Skip to content

Changing the PHP Time Zone Setting

By default, PHP scripts on ruachost.com servers use the US Eastern Standard Time (EST) zone. You can change this setting to match your local time zone by modifying the date.timezone directive in a custom php.ini file.

  • Ensure timestamps in logs, databases, and applications match your local region.
  • Prevent confusion when scheduling tasks or displaying dates to users.
  • Improve consistency across applications that rely on accurate time data.

Step 1: Create or Edit a Custom php.ini File

Section titled “Step 1: Create or Edit a Custom php.ini File”
  1. Log in to cPanel or access your hosting account via File Manager/SSH.

  2. Navigate to your application’s root directory (e.g., /public_html).

  3. Create or edit a php.ini file.

  4. Add the directive:

    date.timezone = "Africa/Lagos"

    Replace "Africa/Lagos" with your desired time zone.

For a complete list of supported time zones, visit the PHP manual time zones list.

Examples:

  • "Europe/Paris"
  • "America/New_York"
  • "Asia/Tokyo"
  • "Africa/Lagos"
  • Always set date.timezone explicitly to avoid relying on server defaults.
  • Use region‑based identifiers (e.g., Africa/Lagos) instead of generic ones (GMT, UTC) for clarity.
  • Test applications after changing the time zone to ensure date/time functions behave correctly.