php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8725 Fun with putenv
Submitted: 2001-01-15 15:53 UTC Modified: 2002-08-13 22:39 UTC
From: mikhail at whasup dot com Assigned:
Status: Not a bug Package: Program Execution
PHP Version: 4.0.4pl1 OS: SCO Openserver 5.05
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: mikhail at whasup dot com
New email:
PHP Version: OS:

 

 [2001-01-15 15:53 UTC] mikhail at whasup dot com
[this is a re-sent of my message, I accidentally inserted php config options in
the wrong place of  my previous message]

Apache: 1.3.14 (with mod_php4 among other)

test.phtml:
<?
 putenv("one=one");
 $one=getenv("one");
 exec("echo two", $two, $ret);
 print("1: $one<br>");
 print("2: $two[0] ($ret)<br>");
?>

Browser shows:
1: one
2: two (0)

After hitting Reload, browser shows:
1: one
2: two (0)

After hitting Reload again, browser shows:
1: one
Warning: Undefined index: 0 in /u/local/apache/htdocs/test.phtml on line 6
2: (1)

After "apachectl restart"  the above repeats...

Config options:
configure  --with-gd=/usr/local/gd --with-mysql --with-jpeg-dir=/tmp/jpeg-6b
 --with-apache=../apache_1.3.14

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-15 18:04 UTC] sniper@php.net
I tried your script in my system (Linux) and with the latest CVS of PHP 4 
and it works just fine. Could you try the latest snapshot from http://snaps.php.net/
to verify if this is fixed or if it is your system that causes this.

--Jani
 [2001-03-09 21:09 UTC] sniper@php.net
User feedback:
--------------
The latest snapshot made no difference. The behavior I 
describe persists. It's always the third execution of the 
script (second page reload) that produces the failure. By 
the way, at that point not only "exec" stops working, but 
"system" and "passthru" as well. It appears that "putenv" is
the cause, since removing it from the script remedies the 
problem (after apache restart there is).

It's quite possible that the problem is unique to my 
environment:

SCO Opendesktop 5.05
Apache/1.3.14 with mod_php4

but that doesn't make the situation any easier.

Couple of more points:

-- the same script works fine when executed on the shell level
-- every time phtml script fails, the following message is left in access_log: ": is not an identifier".

If this matter is of any interest to the developers, I'll be 
more than happy to investigate (with proper guidance :-)) 
further.

Thanks.

-mk

 [2001-05-07 12:47 UTC] derick@php.net
Marking as "fix-before-4.0.6"
 [2001-05-07 20:01 UTC] zeev@php.net
This apperas to be SCO specific so it's not very fixable.  Remarking as 'Open'.
mikhail@whasup.com, will it be possible to have a temporary account on your machine to debug this?  Or does anybody else have access to this platform?
 [2001-05-08 06:25 UTC] mikhail at whasup dot com
Unfortunately, my SCO Unix machine isn't available for access from outside.

 [2001-12-22 06:57 UTC] lobbin@php.net
Does this still happen with 4.1.0?

R.
 [2001-12-23 17:04 UTC] mikhail at whasup dot com
I can't tell because I can't compile it. Since  last time we spoke, I upgraded
to SCO OpenServer 5.06 and right now I can't compile even those versions of
PHP I used to compile without a problem under 5.05. The error I'm getting
is (after removing "-silent " from libtool):

gcc -I. -I/tmp/php-4.1.0/ -I/tmp/php-4.1.0/main -I/tmp/php-4.1.0 \
-I/tmp/php-4.1.0/Zend -I/tmp/php-4.1.0/ext/mysql/libmysql \
-I/tmp/php-4.1.0/ext/xml/expat -I/tmp/php-4.1.0/TSRM \
-g -O2 -o php stub.o  ./.libs/libphp4.a -ldl -lcrypt -lresolv -lm -lsocket

Undefined                       first referenced
 symbol                             in file
freeaddrinfo                        ./.libs/libphp4.a(network.o)
getaddrinfo                         ./.libs/libphp4.a(network.o)
php: fatal error: Symbol referencing errors. No output written to php
collect2: ld returned 1 exit status

There is probably something in the environment of  SCO 5.06 (or my particular
environment) that  is causing it. I even tried the very latest gcc (3.0.3)
and gnu compiling tools to no avail. I'll get back to you if I can figure out
the problem. 

 [2001-12-24 17:39 UTC] mikhail at whasup dot com
The workaround for the problem with "freeaddrinfo" and "getaddrinfo"  was
to undefine HAVE_GETADDRINFO in main/php_config.h.

The original problem with "putenv"  is still there in 4.1.0 compiled with the latest
to date apache 1.3.22  Sorry.


 [2002-02-13 13:45 UTC] david at djwhome dot demon dot co dot uk
The following URL may be relevant.  Basically, SCO's Bourne shell doesn't tolerate broken environments whereas other shells silently ignore errors.

<http://groups.google.com/groups?hl=en&selm=7k1b53%24aun%241%40elf.bsdi.com>

(I'd appreciate any alternative explanations of this error when using system() on SCO Unix, by direct email.)
 [2002-02-13 19:19 UTC] mikhail at whasup dot com
It's might be relevant, but the variables I'm trying to set are perfectly "legal" under the Bourne shell (see example in  my original message). By the way, in the URL you have provided, the syntax  of "export" command won't work under SCO /bin/sh. Rather than "export A=foo" you would have to say "A=foo export A".

-mk
 [2002-08-13 22:39 UTC] kalowsky@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 08:01:28 2024 UTC