php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37908 putenv() variables not reset at the end of the script
Submitted: 2006-06-25 12:56 UTC Modified: 2006-07-28 01:00 UTC
From: php at raj dot homelinux dot com Assigned:
Status: No Feedback Package: Apache2 related
PHP Version: 4.4.2 OS: Linux 2.6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at raj dot homelinux dot com
New email:
PHP Version: OS:

 

 [2006-06-25 12:56 UTC] php at raj dot homelinux dot com
Description:
------------
putenv() claims that the env variables are reset to their original values when the script exits.  HOwever, this doesn't seem to be happening - as a result, if the env var TZ is set from a php script, it affects apache2 logs, changing the timestamp for all subsequent gets served by the process that ran this php script which set TZ.  


Reproduce code:
---------------
 set $timezone different from server timezone and run:

 putenv("TZ=".$timeZone);

--
then do a few more gets and check the apache logs, you will see something like:


xx.xx.xx.xx - - [19/Jun/2006:23:05:18 -0400] "GET ..."
xx.xx.xx.xx - - [19/Jun/2006:23:05:18 -0400] "GET ..."
xx.xx.xx.xx - - [20/Jun/2006:13:05:11 +1000] "GET ..."

(see how the timestamp in the apache log flipped from -0400 to +1000.. thats the problem)

Expected result:
----------------
Timestamps should remain consistent

Actual result:
--------------
Timestamps are not consistent (see example above)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-25 13:36 UTC] tony2001@php.net
What kind of MPM are you using?
 [2006-06-25 14:16 UTC] php at raj dot homelinux dot com
MPM?

Here's what I'm using (wbel3)
kernel-2.4.21-40.EL
php-4.3.2-30.ent
httpd-2.0.46-56.ent.WB1

and the program in question is squirrelmail 
squirrelmail-1.4.6-5.el3
(in include/validate.php)

I submitted a bug report to squirrelmail, from where i got pointed to the putenv() documentation and the fact that putenv() isn't working as expected.  See user comments on the putenv() page as well.
 [2006-06-25 14:36 UTC] tony2001@php.net
Is it apache2-prefork or apache2-worker?
`httpd -V` usually helps.
 [2006-06-25 20:06 UTC] php at raj dot homelinux dot com
this is the 'stock' apache server from RedHat / WBEL

# httpd -V
Server version: Apache/2.0.46
Server built:   Mar 14 2006 20:20:20
Server's Module Magic Number: 20020903:4
Architecture:   32-bit
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
 [2006-07-28 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 12:01:33 2025 UTC