Page 1 of 1

MySQL/PHP6 bible

Posted: Thu Sep 23, 2010 7:57 am
by Orsen
Hello there,

I've just started out recently, I downloaded a .pdf which was as displayed in the thread title.

Basically, I am following the examples in the guide and find that the examples never seem to work when I manually add them into notepad they seem to do the trick but there is one line in particular my server hates.

Code: Select all

<P>You are visiting our site at <?php echo date(‘Y-m-d H:i:s’);?></P>
This was taken straight from the guide.

The error I am recieving is this:
Warning: Unknown: 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 'Europe/London' for '1.0/DST' instead in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\index.php on line 13

Parse error: syntax error, unexpected T_STRING in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\index.php on line 13
Would be greatly appreciated if someone could shed some light on this, thank you for reading.

Re: MySQL/PHP6 bible

Posted: Thu Sep 23, 2010 8:46 am
by requinix
Open up your php.ini file, find the date.timezone setting, and set it to

Code: Select all

date.timezone = Europe/London
Then restart Apache.

For the error, you can't use smart quotes in PHP. Change the two to regular quotes: " or ' will work fine so long as you pair them.

Re: MySQL/PHP6 bible

Posted: Thu Sep 23, 2010 9:53 am
by Orsen
Firstly thanks for the reply the time and date are now displaying, however on the page there are still 2 error's appearing.
Warning: date() [function.date]: 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 'Europe/London' for '1.0/DST' instead in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\index.php on line 13
Both error's say the same thing.

Sorry to be a hassle, I am new to this just wondering if you could shed some light on these errors, thanks again.

Re: MySQL/PHP6 bible

Posted: Thu Sep 23, 2010 9:08 pm
by requinix
It's rather self-explanatory: you need to set the date.timezone setting to a proper timezone (and restart), or use something like date_default_timezone_set in your scripts. Since the latter is a bother, the former is better.

Re: MySQL/PHP6 bible

Posted: Mon Sep 27, 2010 5:22 am
by Orsen
Thanks for your assistance, everything is working perfectly now.

Greatly appreciated. : )

Re: MySQL/PHP6 bible

Posted: Mon Sep 27, 2010 6:19 am
by Orsen
I might have said perfectly but I've noticed the text is confusing.
You are visiting our site at E000000Mon, 27 Sep 2010 12:17:22 +01002010pEurope/London/0201092720109
It should only display:
Mon, 27 Sep 2010 12:17:22

Re: MySQL/PHP6 bible

Posted: Mon Sep 27, 2010 6:20 am
by Orsen
Nevermind fixed it!

Thanks again.