MySQL/PHP6 bible

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Orsen
Forum Newbie
Posts: 11
Joined: Thu Sep 23, 2010 7:51 am

MySQL/PHP6 bible

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: MySQL/PHP6 bible

Post 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.
Orsen
Forum Newbie
Posts: 11
Joined: Thu Sep 23, 2010 7:51 am

Re: MySQL/PHP6 bible

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: MySQL/PHP6 bible

Post 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.
Orsen
Forum Newbie
Posts: 11
Joined: Thu Sep 23, 2010 7:51 am

Re: MySQL/PHP6 bible

Post by Orsen »

Thanks for your assistance, everything is working perfectly now.

Greatly appreciated. : )
Orsen
Forum Newbie
Posts: 11
Joined: Thu Sep 23, 2010 7:51 am

Re: MySQL/PHP6 bible

Post 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
Orsen
Forum Newbie
Posts: 11
Joined: Thu Sep 23, 2010 7:51 am

Re: MySQL/PHP6 bible

Post by Orsen »

Nevermind fixed it!

Thanks again.
Post Reply