httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yehuda Katz <yeh...@ymkatz.net>
Subject Re: [users@httpd] Date Format of Shell Program Changes in Apache
Date Fri, 01 Jul 2016 21:50:08 GMT
This is because of the locale settings. I changed the script to show the
locale (and to be plain text so the spaces are visible).

#!/usr/bin/perl
> use strict;
> print "content-type: text/plain\n\n";
> print `who`;
> print `locale`;


Apache shows this:

yehuda   pts/2        Jul  1 17:37 (pool-xxxxxx.washdc.fios.verizon.net)
> LANG=
> LANGUAGE=
> LC_CTYPE="POSIX"
> LC_NUMERIC="POSIX"
> LC_TIME="POSIX"
> LC_COLLATE="POSIX"
> LC_MONETARY="POSIX"
> LC_MESSAGES="POSIX"
> LC_PAPER="POSIX"
> LC_NAME="POSIX"
> LC_ADDRESS="POSIX"
> LC_TELEPHONE="POSIX"
> LC_MEASUREMENT="POSIX"
> LC_IDENTIFICATION="POSIX"
> LC_ALL=


And the command line shows this:

content-type: text/plain
>


yehuda   pts/2        2016-07-01 17:37 (pool-xxxxxx.washdc.fios.verizon.net)
> LANG=en_US.UTF-8
> LANGUAGE=
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=



The environment variable that sets how the time is shown is LC_TIME.
You can probably change this in your script (for example, php provides a way
<http://php.net/manual/en/function.setlocale.php>, perl likely has one too)
and there is a third-party module that claims to set the locale for the
whole server.
Your OS might also give you a way to set it for the whole server.

- Y


On Fri, Jul 1, 2016 at 4:34 PM, Rob McAninch <rob.mcaninch@gmail.com> wrote:

> Server version: Apache/2.4.10 (Debian)
>
> This seems like it should be simple but manual pages and searching have
> not shown me an answer yet. Reduced it to as simple as I can, I don't
> understand why the date format is different in each.
>
> #!/usr/bin/perl
> use strict;
> print "content-type: text/html\n\n";
> print `who`;
>
>
> When I call it up in a web browser I get
>
> rob pts/1 Jul 1 12:28 (192.x.x.x)
>
> The same script on a command line via ssh I get:
>
> prompt$ perl tryme.cgi
> content-type: text/html
>
> rob      pts/1        2016-07-01 12:28 (192.x.x.x)
>
>
>
> --
> Rob
>

Mime
View raw message