skip to Main Content

How to change cPanel date.time zone?

My php.ini is like this:

magic_quotes_gpc = Off;
register_globals = Off;
default_charset = UTF-8;
memory_limit = 64M;
max_execution_time = 36000;
upload_max_filesize = 999M;
safe_mode = Off;
mysql.connect_timeout = 20;
session.auto_start = Off;
session.use_only_cookies = On;
session.use_cookies = On;
session.use_trans_sid = Off;
session.cookie_httponly = On;
session.gc_maxlifetime = 3600;
allow_url_fopen = on;
date.timezone = "US/Central";
display_errors = 1;
error_reporting = E_ALL; 

And phpinfo() shows like this:

5

Answers


  1. if u want to use another timezone in php script you can use

    date_default_timezone_set('America/Los_Angeles');
    
    Login or Signup to reply.
  2. @RAHEEZ PC, you have to restart your apache service after making change in php.ini file. Restarting the server or apache service is must to have your changes in effect.

    Or

    You can set runtime timezone, like this:

    date_default_timezone_set('America/Los_Angeles');
    

    Write above mentioned line in your index.php file or some master file, because it includes all other files of your project.
    I have America/Los_Angeles because it will set USA central time.

    Login or Signup to reply.
  3. Using htaccess file we can able to change timezone

    Adjust default time zone

    SetEnv TZ America/Washington

    Login or Signup to reply.
  4. if you have root access, to set the correct time zone, use the following procedure:

    Log in to your WHM as root.
    Go to "Server Configuration" Section.
    Click on "Server Time".
    Select the appropriate timezone.
    Click on the "Change TimeZone" button.
    

    If the time is still shown incorrectly, you can synchronize the server time with a time server by clicking on “Sync Time with Time Server”.

    Login or Signup to reply.
  5. config/config.php before base_url you should write

    date_default_timezone_set(‘America/Los_Angeles’);

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search