LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-23-2012, 01:46 PM   #1
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
PHP Data/Timezone Problems, Slackware 14.0, php-5.4.7-x86_64-1


I have a PHP application (PHPGedView) that yammers at me:
Quote:
ERROR 2: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone.
0 Error occurred on in function date
1 called from line 356 of file session.php in function require_once
2 called from line 75 of file config.php in function require
3 called from line 29 of file index.php
I already know that date.timezone must be set in /etc/httpd/php.ini and have done so:
Code:
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "America/New_York"

; http://php.net/date.default-latitude
;date.default_latitude = 31.7667

; http://php.net/date.default-longitude
;date.default_longitude = 35.2333

; http://php.net/date.sunrise-zenith
;date.sunrise_zenith = 90.583333

; http://php.net/date.sunset-zenith
;date.sunset_zenith = 90.583333
Running phpinfo.php with the above shows me:
Code:
date/time support 	enabled
"Olson" Timezone Database Version 	2012.3
Timezone Database 	internal
Default timezone 	UTC

Directive	Local Value	Master Value
date.default_latitude	31.7667	31.7667
date.default_longitude	35.2333	35.2333
date.sunrise_zenith	90.583333	90.583333
date.sunset_zenith	90.583333	90.583333
date.timezone	America/New_York	America/New_York
Now, the default.timezone is set to "America/New York" but the value shows up as UTC here and that causes the problem in the application.

I have tried setting the value to "America/Detroit" which phpinfo.php displays as
Code:
date/time support 	enabled
"Olson" Timezone Database Version 	2012.3
Timezone Database 	internal
Default timezone 	America/Detroit

Directive	Local Value	Master Value
date.default_latitude	31.7667	31.7667
date.default_longitude	35.2333	35.2333
date.sunrise_zenith	90.583333	90.583333
date.sunset_zenith	90.583333	90.583333
date.timezone	America/Detroit	America/Detroit
but application displays the same nonsense (albeit in a slight different format) about
Quote:
ERROR 2: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone.
0 Error occurred on in function date
Uh... WTF?

My hardware clock is set to UTC and I define US/Eastern when setting the system timezone.

Is there something I've missed?

Last edited by tronayne; 10-23-2012 at 01:53 PM.
 
Old 10-23-2012, 03:09 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
I think this applies to you.

http://sourceforge.net/tracker/?func...56&atid=634867
 
Old 10-23-2012, 04:03 PM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Thanks for the link but... I've already done all that, no joy in Mudville.

I'm beginning to suspect that PHPGedView is kaput.

Sigh.
 
Old 10-24-2012, 10:25 AM   #4
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
All right, got it more-or-less fixed (I blew away the application and re installed it).

You pretty much have to edit /etc/httpd/php.ini to define your date.timezone (PHP will no longer use the system date and you'll get all the errors if you use any of the date functions).

I happen to be in the U.S. eastern time zone and, even though there is a setting for Detroit (I'm in northern Michigan) I just chose to use the New York setting:
Code:
vi /etc/httpd/php.ini
<find the string date.timezone>
date.timezone = "America/New_York"
Don't forget to replace blanks in a place name with underscores.

I also un-commented the latitude, longitude and zenith settings but that doesn't appear to be necessary.

The reference material is found at http://www.php.net/manual/en/class.d...stants.america, including a list of the supported time zones (at the left edge of the web page).

When you change /etc/httpd/php.ini, you'll need to restart the httpd daemon.

You can then use a phpinfo.php file to display the Date values.

Hope this helps some.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] CentOS: php-devel-5.1.6-32.el5.x86_64 from base has depsolving problems lrtward Linux - Server 7 03-23-2012 11:05 AM
PHP: Problems comparing data from a DB with data from http request eantoranz Programming 3 08-14-2008 07:55 PM
slackware, apache and PHP from .tgz - problems with PHP szymon Slackware 2 09-06-2004 04:57 PM
problems running php on slackware 9.1 uglyugly Slackware 1 01-29-2004 05:22 PM
Problems with php 4.2.1 form-data and hidden variables coea77 Programming 1 10-10-2002 03:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration