FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Date/Time warning
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
Date/Time warning [message #177746] Fri, 20 April 2012 02:44 Go to next message
Torsten Jrgensen is currently offline  Torsten Jrgensen
Messages: 16
Registered: April 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I get a warning about timezones when using date(). Is there something
new in PHP, I've
just migrated from one mac to another.

/Luser :-(
Re: Date/Time warning [message #177747 is a reply to message #177746] Fri, 20 April 2012 02:47 Go to previous messageGo to next message
Goran is currently offline  Goran
Messages: 38
Registered: January 2011
Karma: 0
Member
add to buddy list
ignore all messages by this user
On 20.4.2012 8:44, Torsten Jørgensen wrote:
> I get a warning about timezones when using date(). Is there something
> new in PHP, I've
> just migrated from one mac to another.

Probably you should configure default time zone in php.ini.
Re: Date/Time warning [message #177748 is a reply to message #177747] Fri, 20 April 2012 03:12 Go to previous messageGo to next message
Torsten Jrgensen is currently offline  Torsten Jrgensen
Messages: 16
Registered: April 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
On 2012-04-20 06:47:06 +0000, Goran said:

> On 20.4.2012 8:44, Torsten Jørgensen wrote:
>> I get a warning about timezones when using date(). Is there something
>> new in PHP, I've
>> just migrated from one mac to another.
>
> Probably you should configure default time zone in php.ini.

Thankyou, cool - but I can't find php.ini. Could you give me
a little more help. I should probably write something like
Europe/Copenhagen, but what is the directive exactly?

/Torsten
---
Nobody dies in WarZone!
Re: Date/Time warning [message #177749 is a reply to message #177748] Fri, 20 April 2012 03:21 Go to previous messageGo to next message
Goran is currently offline  Goran
Messages: 38
Registered: January 2011
Karma: 0
Member
add to buddy list
ignore all messages by this user
On 20.4.2012 9:12, Torsten Jørgensen wrote:
> On 2012-04-20 06:47:06 +0000, Goran said:
>
>> On 20.4.2012 8:44, Torsten Jørgensen wrote:
>>> I get a warning about timezones when using date(). Is there something
>>> new in PHP, I've
>>> just migrated from one mac to another.
>>
>> Probably you should configure default time zone in php.ini.
>
> Thankyou, cool - but I can't find php.ini. Could you give me
> a little more help. I should probably write something like
> Europe/Copenhagen, but what is the directive exactly?

Which os you are using? If its linux try "locate php.ini"

date.timezone:
http://php.net/manual/en/datetime.configuration.php

Supported timezones:
http://php.net/manual/en/timezones.php
Re: Date/Time warning [message #177750 is a reply to message #177749] Fri, 20 April 2012 03:49 Go to previous messageGo to next message
Torsten Jrgensen is currently offline  Torsten Jrgensen
Messages: 16
Registered: April 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
On 2012-04-20 07:21:11 +0000, Goran said:

> On 20.4.2012 9:12, Torsten Jørgensen wrote:
>> On 2012-04-20 06:47:06 +0000, Goran said:
>>
>>> On 20.4.2012 8:44, Torsten Jørgensen wrote:
>>>> I get a warning about timezones when using date(). Is there something
>>>> new in PHP, I've
>>>> just migrated from one mac to another.
>>>
>>> Probably you should configure default time zone in php.ini.
>>
>> Thankyou, cool - but I can't find php.ini. Could you give me
>> a little more help. I should probably write something like
>> Europe/Copenhagen, but what is the directive exactly?
>
> Which os you are using? If its linux try "locate php.ini"
^^^ ^^^^^^^^^^^^^^^
OSX Lion (Mac) Can not make it work(1)
>
> date.timezone:
> http://php.net/manual/en/datetime.configuration.php
>
> Supported timezones:
> http://php.net/manual/en/timezones.php

(1) Build and loaded the database, but can not do a locate - says the database
is not there - in strict contradiction with a repitition of the build command
which claims that it (the database is there) ... HOP!

Anyway, where does php.ini normally exist - on a UNIX system, or a Mac or
whatever it is.
--
This time machine is really funky...
Re: Date/Time warning [message #177751 is a reply to message #177746] Fri, 20 April 2012 03:59 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
El 20/04/2012 8:44, Torsten Jørgensen escribió/wrote:
> I get a warning about timezones when using date(). Is there something
> new in PHP, I've
> just migrated from one mac to another.

I wouldn't say it's new (it's been around for several years). You've
carefully ignored the error message but it contains a complete
explanation of what you must do, something like this:

Warning: date() [http://es.php.net/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/Paris' for '2.0/DST' instead

Always read error messages: they are there to help, not to annoy, and
they normally contain useful info.

P.S. You can find the path for your "php.ini" file with this script:

<?php

phpinfo();


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Re: Date/Time warning [message #177756 is a reply to message #177746] Fri, 20 April 2012 05:23 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
In article <2012042008442967926-info@stconinccom>,
Torsten Jørgensen <info(at)stconinc(dot)com> wrote:

> I get a warning about timezones when using date(). Is there something
> new in PHP, I've just migrated from one mac to another.

You've upgraded to a version that needs it. I do this in any CLI PHp
script I run, if I'm going to use any time/date function:

$timezone = getHosttimezone (); // Ask system for time zone
date_default_timezone_set ($timezone);

Since most of my scripts are run by apache, I also do this in the
httpd.conf file:

php_value date.timezone 'timezone-string'

where you replace timezone-string with the string for your time-zone.
Under OS X 10.7.3, this file is at:

/private/etc/apache/httpd.conf


php.ini.default can be found at:

/private/etc/php.ini.default

You probably want to copy that to php.ini in the same directory and then
edit as others have suggested.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: Date/Time warning [message #177758 is a reply to message #177756] Fri, 20 April 2012 05:27 Go to previous messageGo to next message
Torsten Jrgensen is currently offline  Torsten Jrgensen
Messages: 16
Registered: April 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
On 2012-04-20 09:23:02 +0000, Tim Streater said:

> In article <2012042008442967926-info@stconinccom>,
> Torsten Jørgensen <info(at)stconinc(dot)com> wrote:
>
>> I get a warning about timezones when using date(). Is there something
>> new in PHP, I've just migrated from one mac to another.
>
> You've upgraded to a version that needs it. I do this in any CLI PHp
> script I run, if I'm going to use any time/date function:
>
> $timezone = getHosttimezone (); // Ask system for time zone
> date_default_timezone_set ($timezone);
>
> Since most of my scripts are run by apache, I also do this in the
> httpd.conf file:
>
> php_value date.timezone 'timezone-string'
>
> where you replace timezone-string with the string for your time-zone.
> Under OS X 10.7.3, this file is at:
>
> /private/etc/apache/httpd.conf
>
>
> php.ini.default can be found at:
>
> /private/etc/php.ini.default
>
> You probably want to copy that to php.ini in the same directory and
> then edit as others have suggested.

Massive! Thanks Tim.

/Torsten
--
This time machine is really funky...
Re: Date/Time warning [message #177763 is a reply to message #177750] Fri, 20 April 2012 08:13 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 4/20/2012 3:49 AM, Torsten Jørgensen wrote:
> On 2012-04-20 07:21:11 +0000, Goran said:
>
>> On 20.4.2012 9:12, Torsten Jørgensen wrote:
>>> On 2012-04-20 06:47:06 +0000, Goran said:
>>>
>>>> On 20.4.2012 8:44, Torsten Jørgensen wrote:
>>>> > I get a warning about timezones when using date(). Is there something
>>>> > new in PHP, I've
>>>> > just migrated from one mac to another.
>>>>
>>>> Probably you should configure default time zone in php.ini.
>>>
>>> Thankyou, cool - but I can't find php.ini. Could you give me
>>> a little more help. I should probably write something like
>>> Europe/Copenhagen, but what is the directive exactly?
>>
>> Which os you are using? If its linux try "locate php.ini"
> ^^^ ^^^^^^^^^^^^^^^
> OSX Lion (Mac) Can not make it work(1)
>>
>> date.timezone:
>> http://php.net/manual/en/datetime.configuration.php
>>
>> Supported timezones:
>> http://php.net/manual/en/timezones.php
>
> (1) Build and loaded the database, but can not do a locate - says the
> database
> is not there - in strict contradiction with a repitition of the build
> command
> which claims that it (the database is there) ... HOP!
>
> Anyway, where does php.ini normally exist - on a UNIX system, or a Mac or
> whatever it is.

Fix your system. And where it exists is dependent on your version of
Linux. There is no one place on all systems.

Alternatively, look up phpinfo().

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Date/Time warning [message #177764 is a reply to message #177763] Fri, 20 April 2012 10:43 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
In article <jmrjtn$ubd$3(at)dont-email(dot)me>,
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:

> On 4/20/2012 3:49 AM, Torsten Jørgensen wrote:
>> On 2012-04-20 07:21:11 +0000, Goran said:
>>
>>> On 20.4.2012 9:12, Torsten Jørgensen wrote:
>>>> On 2012-04-20 06:47:06 +0000, Goran said:
>>>>
>>>> > On 20.4.2012 8:44, Torsten Jørgensen wrote:
>>>> >> I get a warning about timezones when using date(). Is there something
>>>> >> new in PHP, I've
>>>> >> just migrated from one mac to another.
>>>> >
>>>> > Probably you should configure default time zone in php.ini.
>>>>
>>>> Thankyou, cool - but I can't find php.ini. Could you give me
>>>> a little more help. I should probably write something like
>>>> Europe/Copenhagen, but what is the directive exactly?
>>>
>>> Which os you are using? If its linux try "locate php.ini"
>> ^^^ ^^^^^^^^^^^^^^^
>> OSX Lion (Mac) Can not make it work(1)
>>>
>>> date.timezone:
>>> http://php.net/manual/en/datetime.configuration.php
>>>
>>> Supported timezones:
>>> http://php.net/manual/en/timezones.php
>>
>> (1) Build and loaded the database, but can not do a locate - says the
>> database
>> is not there - in strict contradiction with a repitition of the build
>> command
>> which claims that it (the database is there) ... HOP!
>>
>> Anyway, where does php.ini normally exist - on a UNIX system, or a Mac or
>> whatever it is.
>
> Fix your system. And where it exists is dependent on your version of
> Linux. There is no one place on all systems.

He isn't running linux, you silly boy.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: Date/Time warning [message #177766 is a reply to message #177750] Fri, 20 April 2012 11:03 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On Fri, 20 Apr 2012 09:49:20 +0200, Torsten Jørgensen wrote:

> Anyway, where does php.ini normally exist - on a UNIX system, or a Mac
> or whatever it is.

Googling suggests that it's likely to be in /private/etc/php.ini *but*
you may have instead /private/etc/php.ini.default - in which case you
need to copy it:

cd /private /etc
cp php.ini.default php.ini

Disclaimer - this is what I found with google, I have no knowledge of the
accuracy and veracity of this solution!

Rgds

Denis McMahon
Re: Date/Time warning [message #177772 is a reply to message #177764] Fri, 20 April 2012 14:21 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 4/20/2012 10:43 AM, Tim Streater wrote:
> In article <jmrjtn$ubd$3(at)dont-email(dot)me>,
> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>
>> On 4/20/2012 3:49 AM, Torsten Jørgensen wrote:
>>> On 2012-04-20 07:21:11 +0000, Goran said:
>>>
>>>> On 20.4.2012 9:12, Torsten Jørgensen wrote:
>>>> > On 2012-04-20 06:47:06 +0000, Goran said:
>>>> >
>>>> >> On 20.4.2012 8:44, Torsten Jørgensen wrote:
>>>> >>> I get a warning about timezones when using date(). Is there
>> something
>>>> >>> new in PHP, I've
>>>> >>> just migrated from one mac to another.
>>>> >>
>>>> >> Probably you should configure default time zone in php.ini.
>>>> >
>>>> > Thankyou, cool - but I can't find php.ini. Could you give me
>>>> > a little more help. I should probably write something like
>>>> > Europe/Copenhagen, but what is the directive exactly?
>>>>
>>>> Which os you are using? If its linux try "locate php.ini"
>>> ^^^ ^^^^^^^^^^^^^^^
>>> OSX Lion (Mac) Can not make it work(1)
>>>>
>>>> date.timezone:
>>>> http://php.net/manual/en/datetime.configuration.php
>>>>
>>>> Supported timezones:
>>>> http://php.net/manual/en/timezones.php
>>>
>>> (1) Build and loaded the database, but can not do a locate - says the
>>> database
>>> is not there - in strict contradiction with a repitition of the build
>>> command
>>> which claims that it (the database is there) ... HOP!
>>>
>>> Anyway, where does php.ini normally exist - on a UNIX system, or a
>> Mac or
>>> whatever it is.
>>
>> Fix your system. And where it exists is dependent on your version of
>> Linux. There is no one place on all systems.
>
> He isn't running linux, you silly boy.
>

Try again, your silly boy. What do you think Apples are running nowadays?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Date/Time warning [message #177776 is a reply to message #177772] Fri, 20 April 2012 15:31 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
In article <jms9fn$5le$1(at)dont-email(dot)me>,
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:

> On 4/20/2012 10:43 AM, Tim Streater wrote:

>> He isn't running linux, you silly boy.

> Try again, your silly boy. What do you think Apples are running nowadays?

BSD, last I heard.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: Date/Time warning [message #177801 is a reply to message #177748] Sat, 21 April 2012 12:56 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
Torsten Jørgensen wrote:

> On 2012-04-20 06:47:06 +0000, Goran said:
>> On 20.4.2012 8:44, Torsten Jørgensen wrote:
>>> I get a warning about timezones when using date(). Is there something
>>> new in PHP, I've
>>> just migrated from one mac to another.
>> Probably you should configure default time zone in php.ini.
>
> Thankyou, cool - but I can't find php.ini. […]

It is located where phpinfo() says it is. RTFM.

> ---
> Nobody dies in WarZone!

That is _not_ a signature. This is:

--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Re: Date/Time warning [message #177802 is a reply to message #177749] Sat, 21 April 2012 13:09 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
Goran wrote:

> On 20.4.2012 9:12, Torsten Jørgensen wrote:
>> On 2012-04-20 06:47:06 +0000, Goran said:
>>> On 20.4.2012 8:44, Torsten Jørgensen wrote:
>>>> I get a warning about timezones when using date(). Is there something
>>>> new in PHP, I've
>>>> just migrated from one mac to another.
>>> Probably you should configure default time zone in php.ini.
>>
>> Thankyou, cool - but I can't find php.ini. Could you give me
>> a little more help. I should probably write something like
>> Europe/Copenhagen, but what is the directive exactly?
>
> Which os you are using? If its linux try "locate php.ini"

locate(1) will not yield useful results unless updatedb(1) had been run on
that system first and the directories in question are included in the
indexing and the user running updatedb(1) has had permission to read the
pertinent directories and files. There is no requirement that – assuming
the findutils are even installed – updatedb(1) be run as a root cron job on
a Linux-based system. If updatedb(1) had been run, locate(1) may very well
yield several paths for php.ini as each server version and PHP variant (in
particular (PHP Apache module and PHP CLI) likely will have its own
configuration.

Bottom line: In 9 of 10 cases the output of `locate php.ini' is completely
useless.

When in doubt, call phpinfo() in the *same* PHP program first. It tells you
where php.ini for that program is located and what *other* configuration
files are considered that may very well contain the setting in question
(which is especially common on Linux-based systems because of convenient
package management for PHP extensions), so as to avoid modifying the wrong
file or duplicating settings (with adverse effect on the duplicate or the
duplicated setting).


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: php include, function, ...
Next Topic: session question
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Oct 23 18:15:47 EDT 2017

Total time taken to generate the page: 0.00867 seconds