On 04 Jan 2012 at 21:01, Robert Williams <rewilli...@thesba.com> wrote: 

> On 1/4/12 13:33, "Tim Streater" <t...@clothears.org.uk> wrote:
>
> Also, if I remember right, Apple sets up Apache so that each user has
> his/her own config file inside the conf folder. You should make any config
> changes, such as turning on PHP, in there, rather than in the primary
> config file. The latter is subject to being overwritten on OS updates and
> upgrades, while the former is not. Segregating your changes also makes it
> easier to tell exactly what you've changed from the defaults.

This is true.

>> I'm however carefully ensuring that the client and server aspects of my
>> app (which will both run on the user's machine) don't use anything except
>> what comes with the standard OS X distribution, so to fix the date time
>> issue I do:
>>
>>  date_default_timezone_set (@date_default_timezone_get ());
>
> I recommend against this. First of all, in PHP 5.4, this is just going to
> return UTC if you haven't explicitly set the time zone, and that's
> probably not what you want. Plus, the use of @ here leaves a nasty taste
> in the mouth (as it does in most cases).
>
> Instead, I suggest creating a php.ini file and changing this setting there
> by setting it to a specific time zone. For example, in mine, I have this
> line:
>
>        date.timezone = 'America/Phoenix'

As I hinted in my previous mail, client and server side of my app are always on 
the user's machine. When the user starts the app, I create an apache config 
file on the fly and run an instance of apache just for the user. So I'm not 
messing with the standard OS X Web Sharing. For the same reason, I don't want 
to start modifying or creating a php.ini file.

> This ensures that PHP is always using the same zone no matter what script
> is running, avoids PHP errors if you forget to make the change in a
> script, avoids you having to modify all your scripts in the first place,
> and lets you easily change the time zone used by your applications to
> whatever you want independently of the server's own time zone (or in 5.4,
> to something other than UTC).

Hmm, just looked more carefully at the docs. I see I'm going to have to add a 
prefs setting so the user can tell my app what timezone they are in. I find it 
odd that the OS can't provide this information.



--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to