How to set the timezone in php.ini file on VPS CentOS? PHP relies on the date.timezone value for some date/time functions executed by php-based applications. Sometimes you even get an error message on your webserver logs that clearly indicates this necessity. Fortunately, this is easy to accomplish and we will show you how. For this guide, we will be using CentOS 6 with root privileges.
Open the php.ini file
On CentOS, the php.ini file is located at the /etc directory.
sudo vi /etc/php.ini
Depending on the installed version of PHP version, you will find a [Date] section like the following. If it is not there, just add a line with the “date.timezone = Your/Timezone” function.
[Date] ; Defines the default timezone used by the date functions ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone date.timezone =
Uncomment the date.timezone function and set its value to the timezone you need. In this case we will use America/New_York. To see a list of supported timezones, refer to php.net
Now, save and exit the php.ini file.
Restart Apache webserver
In order for the changes to take effect, you need to restart the Apache webserver:
sudo service httpd restart
Congratulations, you have set the time zone in php.ini file.
VPS Server USA