Help Needed

Discussion in 'PHP' started by joaquin, Nov 28, 2011.

  1. #1
    Hello,

    I have a problem that I can't solve.

    My scripts keep sending this error:

    date() [<a href='function.date'>function.date</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead

    Now, I know about php.ini and changing the localzone to America/New_York. I also know about setting the timezone at the beginning of the PHP file, but I can't do this since one of the files is protected and I cannot change it.

    I modified the php.ini, but it's not working. I restarted the server, and again no luck.

    can someone help me solve this?

    Thanks.
     
    joaquin, Nov 28, 2011 IP
  2. codecre8r

    codecre8r Well-Known Member

    Messages:
    148
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    128
    #2
    Just put this at the top of your php file:

    date_default_timezone_set('America/New_York');
    Code (markup):
     
    codecre8r, Nov 29, 2011 IP
  3. codecre8r

    codecre8r Well-Known Member

    Messages:
    148
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    128
    #3
    Sorry, I missed the part where you said you already knew about this. Are you including the protected file in another php file before it's being called? If so, you could use the above statement before it is included.
     
    codecre8r, Nov 29, 2011 IP
  4. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #4
    Script or scripts?

    If its just one script, you could always place the following into a .htaccess file
    date.timezone = "America/New_York"
    Code (markup):
     
    MyVodaFone, Nov 29, 2011 IP