SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: How do I set the default timezone in php.ini file?

  1. #1
    SitePoint Addict Volitics's Avatar
    Join Date
    Aug 2003
    Location
    US
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I set the default timezone in php.ini file?

    .
    Question. How can I set my php.ini file so that the Eastern Time Zone is the default time zone?

    I have a GoDaddy shared hosting. The PHP currently is set with America/Phoenix as the default time zone.

    It is running the following PHP version:
    PHP Version 5.2.17

    GoDaddy's technical support says that I can change the default time zone by adjusting the php.ini. But they said something like I would have to do it myself because changing the php.ini directives was outside of their technical obligations.

    Here is what the PHP Manual says:
    http://sg.php.net/manual/en/datetime....date.timezone

    I have done like the PHP Manual says. I have put the following:

    date.timezone = "America/New_York"

    in the php.ini file but it won't work.

    Here is the entire php.ini file that is in the root folder for the hosting:

    PHP Code:
    register_globals off
    allow_url_fopen 
    off

    expose_php 
    Off
    max_input_time 
    60
    variables_order 
    "EGPCS"
    extension_dir = ./
    upload_tmp_dir = /tmp
    precision 
    12
    SMTP 
    relay-hosting.secureserver.net
    url_rewriter
    .tags "a=href,area=href,frame=src,input=src,form=,fieldset="

    [Zend]
    zend_extension=/usr/local/zo/ZendExtensionManager.so
    zend_extension
    =/usr/local/zo/4_3/ZendOptimizer.so 
    I would appreciate any assistance.

    Thanks.
    .

  2. #2
    Hosting Advisor silver trophybronze trophy
    SitePoint Award Recipient cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    2,812
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    Don't forget that you must restart apache once the php.ini has been updated for the settings to take effect. Otherwise, you can use date_default_timezone_set() in your PHP code

  3. #3
    SitePoint Addict Volitics's Avatar
    Join Date
    Aug 2003
    Location
    US
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cpradio;

    Thank you for responding to my question. I can't reboot the server with a shared hosting.

    The date_default_timezone_set() function works okay. I just discovered that function recently. Before now I did not realize that there was a function like that.

    I was using something like gmdate("Y", time()+($LocalTimeOffset*3600)) in order to get the proper time zone. The date_default_timezone_set() function makes it a lot easier.

    Thanks again.
    .

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •