Help get this topic noticed by sharing it on Twitter, Facebook, or email.

PHP examples returning errors

A number of examples in PHP,MySQL,JavaScript, & CSS return errors such as the following:
Warning: main(): 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\Program Files\Zend\Apache2\htdocs\php,MySql,Java examples\4\example4-23.php on line 4.
I've only gotten to Chapter 4 so far so have no experience beyond that.
This happens with several different examples and I would like to be able to correct the code so that it will work properly.
Can you help?
Thanks,
George Lanning
glanning3@gmail.com
1 person has
this question
+1
Reply
  • Hello George,

    I have forwarded your question on to our Book Tech staff, so they can help you find a solution. If you ever have any questions or issues with the content of a title, you can also contact them directly at booktech@oreilly.com or call them at:

    1-800-889-8969
    or
    1-707-827-7019 (outside the USA)
    7:30 am to 5:00 PST

    Kind regards,
    Paul Fichera
    Customer Service Representative
    O'Reilly Media
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • Hi George,

    There are a couple of ways to solve that problem. Probably the best is to update your php.ini file to include the timezone. Open it in a text editor, and go to the date section and make it say something like this -

    [Date]
    ; Defines the default timezone used by the date functions
    date.timezone = "America/Los_Angeles"

    You can find all of the timezones listed here -
    http://www.php.net/manual/en/timezone...

    Another way to fix that is just to add this line to your php code file, above any date related functions in the code -
    date_default_timezone_set('America/Los_Angeles');

    I hope that helps,
    Chris Olson
    O'Reilly Book Support
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned