LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-18-2011, 09:25 AM   #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
Slackware 64-bit 13.37 php.ini


I need to define date.timezone in PHP for an application and I can't seem to figure out how to get Apache (or whatever) to use changes in /etc/httpd/php.ini.

For example, I need to set the value of date.timezone to America/Detroit and the latitude and longitude values. I'm assuming that simply stopping and restarting HTTPD ought to make that happen (it doesn't) or rebooting the system should (nope). I must have missed something somewhere...

Anybody know how to do that?
 
Old 05-18-2011, 10:15 AM   #2
hakan56
Member
 
Registered: Nov 2004
Location: Sweden
Distribution: Slackware64-14.0
Posts: 53

Rep: Reputation: 9
You can use a .htaccess file...
http://httpd.apache.org/docs/2.2/howto/htaccess.html
..but as you can see...
Quote:
Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance.
I can, however, nothing about php, but hope this link can help you..
http://php.net/manual/en/configuration.changes.php

/Håkan
 
Old 05-18-2011, 10:26 AM   #3
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,097

Rep: Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174
from php.SlackBuild
Code:
./configure \
...
  --with-config-file-scan-dir=/etc/php \
  --with-config-file-path=/etc/httpd \
from "./configure --help"
Code:
  --with-config-file-path=PATH
                          Set the path in which to look for php.ini [PREFIX/lib]
  --with-config-file-scan-dir=PATH
                          Set the path where to scan for configuration files
so it should definitely use /etc/httpd/php.ini (and scan /etc/php folder for a php.ini file too).

In my /etc/httpd/php.ini I got
Code:
[Date]
; Defines the default timezone used by the date functions
date.timezone = "Europe/Rome"

Last edited by ponce; 05-18-2011 at 01:52 PM. Reason: added "folder for a php.ini file"
 
Old 05-18-2011, 12:39 PM   #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
Thanks for the above -- turns out that a combination of stuff (one that some dummy forgot to un-comment some settings in /etc/php.ini) led to the problem.

Maybe this might helps somebody else.

I was migrating PhpGedView, http://www.phpgedview.net/, a genealogy program, from Slackware 13.1 to 13.37 and kept getting warning messages like this:
Code:
18.05.2011 12:10:25 - 192.168.1.10 - Anonymous - 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 'Am
erica/New_York' for 'EDT/-4.0/DST' instead; 0 Error occurred on  in function date1 called from line 356 of file session.ph
p in function require_once2 called from line 75 of file config.php in function require3 called from line 31 of file editge
dcoms.php
Tuns out that simply un-commenting
Code:
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = 'America/New_York'
in /etc/php.ini doesn't do the trick (making the thing stop yammering about relying on the system's timezone settings); you also need to un-comment the latitude, longitude, sunrise-zenith and sunset-zenith settings. So, the appropriate lines in /etc/httpd/php.ini need to look like this:
Code:
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

[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
Those values happen to be the default values (and I happen to live in the US Eastern time zone) but they appear to need to be un-commented for an application that uses time and date functions or you'll get yammered at (which writes all over the web page, making it somewhat difficult to use it).

This appears to be a new "feature" of PHP explained at http://php.net/date.timezone with a list of supported time zones at http://www.php.net/manual/en/timezones.php and a note to not use things like 'US/Eastern' as they only exist for backward compatibility at http://www.php.net/manual/en/timezones.others.php. It seems that using a time zone such as 'US/Eastern' will disappear at some future release of PHP so it may make sense to just bite the bullet and change now to the new standard.

Now I should note that this particular application program would not work properly without the above settings; PhpGedView is picky about sticking to PHP's rules; as always, YMMV.

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] php.ini.rpmsave instead of php.ini ilvista Linux - Server 3 02-01-2011 04:39 PM
PHP won't recognize my Configuration File (php.ini) path kriezo Programming 4 02-14-2008 02:31 AM
php.ini-dist to php.ini lord-fu Programming 10 05-02-2006 05:24 PM
php5 apache2 mysql4 don't work, php does not seem to read php.ini atom Linux - Software 5 03-24-2005 11:05 AM
Upgraded PHP from 4.3.4 to 4.3.10 and now it won't read php.ini gregmcavoy Linux - Software 11 01-22-2005 12:16 PM

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

All times are GMT -5. The time now is 08:31 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