Mac Upgrade Breaks a simple code

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
RobertVJ
Forum Newbie
Posts: 2
Joined: Mon Mar 29, 2010 3:49 pm

Mac Upgrade Breaks a simple code

Post by RobertVJ »

I have used this simple code to output date time on a web page

Code: Select all

$date_time = strtotime("$test hour");
echo date("l - M j, Y - g:i A", $date_time);
Note that the test variable is set to 0 in this case. I use the local Apache server on my Mac to test changes and then FTP changes to the "live server".

Today I updated from OSX 10.5.8 to 10.6.3

While checking things out after the update the local server gives me this
Warning: strtotime() [function.strtotime]: 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. /Sites/home.php on line 78

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. /Sites/home.php on line 79
I have been Googling and have no clue what is going on. It is just a simple time-stamp for the page; I am a php novice and tend to use Perl.

Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Mac Upgrade Breaks a simple code

Post by requinix »

PHP doesn't know which timezone you want to use.

Code: Select all

date_default_timezone_set("Wherever/You_Are");
$date_time = strtotime("$test hour");
echo date("l - M j, Y - g:i A", $date_time);
RobertVJ
Forum Newbie
Posts: 2
Joined: Mon Mar 29, 2010 3:49 pm

Re: Mac Upgrade Breaks a simple code

Post by RobertVJ »

I solved the problem. I needed to un-comment and set the value of date.timezone. Also the php.ini file didn't exit. There was a php.ini.default which I had to duplicate and rename it without the default. The default must be the template.
Post Reply