Re: New to mac and trying to define a php.ini file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/4/12 14:34, "Tim Streater" <tim@xxxxxxxxxxxxxxxx> wrote:

>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.

In that case, you might consider setting it via the Apache config file
that you're creating, which you can do with something like:

        php_value date.timezone 'America/Phoenix'

That'll have the same effect (and benefits) as setting it via php.ini.

>>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.

Well, it typically can, or at least can make a guess at it. The problem is
that it's not something you can rely on across different OSes, as some
handle it differently, or less reliably, or not at all. Basically, the
result is non-deterministic. It's for this reason that, as of 5.4, PHP
won't even ask the OS but will always return UTC (and complain a bit) if
something else hasn't been set. This way, you at least have a chance of
consistent results.

If you're only supporting OS X, you can have your script that generates
the Apache config file retrieve the system time zone, and then use that
value in the php_value setting. If the script is in PHP, you can do this:

        $timeZone = `/usr/sbin/systemsetup -gettimezone`;


Which just calls the systemsetup command line utility (basically, a CLI
front-end to the settings controlled via System Preferences). Here's what
that call returns when run on the command line on my system:

        H012316WHPV:~ rewilliams$ systemsetup -gettimezone
        Time Zone: America/Phoenix



Regards,
Bob
--
Robert E. Williams, Jr.
Associate Vice President of Software Development
Newtek Businesss Services, Inc. -- The Small Business Authority
https://www.newtekreferrals.com/rewjr
http://www.thesba.com/







Notice: This communication, including attachments, may contain information that is confidential. It constitutes non-public information intended to be conveyed only to the designated recipient(s). If the reader or recipient of this communication is not the intended recipient, an employee or agent of the intended recipient who is responsible for delivering it to the intended recipient, or if you believe that you have received this communication in error, please notify the sender immediately by return e-mail and promptly delete this e-mail, including attachments without reading or saving them in any manner. The unauthorized use, dissemination, distribution, or reproduction of this e-mail, including attachments, is prohibited and may be unlawful. If you have received this email in error, please notify us immediately by e-mail or telephone and delete the e-mail and the attachments (if any).

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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux