Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #5577 > unrolled thread

Date/Time warning

Started byTorsten Jørgensen <info@stconinc.com>
First post2012-04-20 08:44 +0200
Last post2012-04-20 11:27 +0200
Articles 15 — 7 participants

Back to article view | Back to comp.lang.php


Contents

  Date/Time warning Torsten Jørgensen <info@stconinc.com> - 2012-04-20 08:44 +0200
    Re: Date/Time warning Goran <goran@nospam.com> - 2012-04-20 08:47 +0200
      Re: Date/Time warning Torsten Jørgensen <info@stconinc.com> - 2012-04-20 09:12 +0200
        Re: Date/Time warning Goran <goran@nospam.com> - 2012-04-20 09:21 +0200
          Re: Date/Time warning Torsten Jørgensen <info@stconinc.com> - 2012-04-20 09:49 +0200
            Re: Date/Time warning Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-20 08:13 -0400
              Re: Date/Time warning Tim Streater <timstreater@greenbee.net> - 2012-04-20 15:43 +0100
                Re: Date/Time warning Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-20 14:21 -0400
                  Re: Date/Time warning Tim Streater <timstreater@greenbee.net> - 2012-04-20 20:31 +0100
            Re: Date/Time warning Denis McMahon <denismfmcmahon@gmail.com> - 2012-04-20 15:03 +0000
          Re: Date/Time warning Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-04-21 19:09 +0200
        Re: Date/Time warning Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-04-21 18:56 +0200
    Re: Date/Time warning "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-04-20 09:59 +0200
    Re: Date/Time warning Tim Streater <timstreater@greenbee.net> - 2012-04-20 10:23 +0100
      Re: Date/Time warning Torsten Jørgensen <info@stconinc.com> - 2012-04-20 11:27 +0200

#5577 — Date/Time warning

FromTorsten Jørgensen <info@stconinc.com>
Date2012-04-20 08:44 +0200
SubjectDate/Time warning
Message-ID<2012042008442967926-info@stconinccom>
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 :-(

[toc] | [next] | [standalone]


#5578

FromGoran <goran@nospam.com>
Date2012-04-20 08:47 +0200
Message-ID<jmr0pa$9rl$1@ss408.t-com.hr>
In reply to#5577
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.

[toc] | [prev] | [next] | [standalone]


#5579

FromTorsten Jørgensen <info@stconinc.com>
Date2012-04-20 09:12 +0200
Message-ID<2012042009124657118-info@stconinccom>
In reply to#5578
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!

[toc] | [prev] | [next] | [standalone]


#5580

FromGoran <goran@nospam.com>
Date2012-04-20 09:21 +0200
Message-ID<jmr2p7$d0e$1@ss408.t-com.hr>
In reply to#5579
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

[toc] | [prev] | [next] | [standalone]


#5581

FromTorsten Jørgensen <info@stconinc.com>
Date2012-04-20 09:49 +0200
Message-ID<2012042009492077721-info@stconinccom>
In reply to#5580
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...

[toc] | [prev] | [next] | [standalone]


#5595

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-04-20 08:13 -0400
Message-ID<jmrjtn$ubd$3@dont-email.me>
In reply to#5581
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@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#5596

FromTim Streater <timstreater@greenbee.net>
Date2012-04-20 15:43 +0100
Message-ID<timstreater-68EDF6.15435320042012@news.individual.net>
In reply to#5595
In article <jmrjtn$ubd$3@dont-email.me>,
 Jerry Stuckle <jstucklex@attglobal.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

[toc] | [prev] | [next] | [standalone]


#5604

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-04-20 14:21 -0400
Message-ID<jms9fn$5le$1@dont-email.me>
In reply to#5596
On 4/20/2012 10:43 AM, Tim Streater wrote:
> In article <jmrjtn$ubd$3@dont-email.me>,
> Jerry Stuckle <jstucklex@attglobal.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@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#5608

FromTim Streater <timstreater@greenbee.net>
Date2012-04-20 20:31 +0100
Message-ID<timstreater-A9225C.20315920042012@news.individual.net>
In reply to#5604
In article <jms9fn$5le$1@dont-email.me>,
 Jerry Stuckle <jstucklex@attglobal.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

[toc] | [prev] | [next] | [standalone]


#5598

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2012-04-20 15:03 +0000
Message-ID<4f917ad6$0$2946$a8266bb1@newsreader.readnews.com>
In reply to#5581
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

[toc] | [prev] | [next] | [standalone]


#5635

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-04-21 19:09 +0200
Message-ID<2984934.dbgypaU67u@PointedEars.de>
In reply to#5580
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

[toc] | [prev] | [next] | [standalone]


#5634

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-04-21 18:56 +0200
Message-ID<6185644.WV9SEqChMi@PointedEars.de>
In reply to#5579
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

[toc] | [prev] | [next] | [standalone]


#5582

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-04-20 09:59 +0200
Message-ID<jmr508$k77$1@dont-email.me>
In reply to#5577
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
--

[toc] | [prev] | [next] | [standalone]


#5588

FromTim Streater <timstreater@greenbee.net>
Date2012-04-20 10:23 +0100
Message-ID<timstreater-1374D9.10230220042012@news.individual.net>
In reply to#5577
In article <2012042008442967926-info@stconinccom>,
 Torsten Jørgensen <info@stconinc.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

[toc] | [prev] | [next] | [standalone]


#5590

FromTorsten Jørgensen <info@stconinc.com>
Date2012-04-20 11:27 +0200
Message-ID<201204201127443209-info@stconinccom>
In reply to#5588
On 2012-04-20 09:23:02 +0000, Tim Streater said:

> In article <2012042008442967926-info@stconinccom>,
>  Torsten Jørgensen <info@stconinc.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...

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web