Setting the correct PHP Timezone
Setting the correct timezone for PHP is essential to ensure accurate timestamps, logging, and date handling on your server. Follow these simple steps to set the PHP timezone on your cPanel/WHM server.
Steps to Change the PHP Timezone
1. Access the Server via SSH
Log into your server using SSH:
ssh root@your-server-ip
2. Edit the php.ini File
For PHP 8.2, open the configuration file:
nano /opt/cpanel/ea-php82/root/etc/php.ini
3. Set the date.timezone Directive
Search for date.timezone
in the file (press Ctrl + W
in nano
). Set the timezone to the desired region. For example:
date.timezone = "America/New_York"
Replace "America/New_York"
with the appropriate timezone string (e.g., Europe/London
, Asia/Tokyo
).