#27401 [Com]: fopen problem
| From: | postings-php-bug at hans-spath dot de | Date: | Thu, 26 Feb 2004 11:07:47 +0000 |
| Subject: | #27401 [Com]: fopen problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-55595@lists.php.net to get a copy of this message | ||
ID: 27401
Comment by: postings-php-bug at hans-spath dot de
Reported By: ycallen at ndsisrael dot com
Status: Open
Bug Type: Apache related
Operating System: RHEL linux
PHP Version: 4.3.4
New Comment:
What happens when you execute the following line on a shell?
wget -O - "http://localhost/~php/recieve.php?param1=1¶m2=2"
Previous Comments:
------------------------------------------------------------------------
[2004-02-26 05:57:54] ycallen at ndsisrael dot com
Description:
------------
I do the following steps:
1.I run apache in debug mode(httpd -X).
2.I have a php script(send.php) that tries to access another php
script(recieve.php)using fopen with a url.The url points to
localhost[example : fopen("http://localhost/~php/recieve.php)].
3.The program hangs and eventually times out with the following warning
: "Warning: fopen(http://localhost/~php/recieve.php?param1=1÷m2=2):
failed to open stream: HTTP request failed! ñ¤ö^ in
/home/php/public_html/send.php on line 6"
This only happens when i run apache in debug mode.When i run apache in
regular mode then it works.
Reproduce code:
---------------
recieve.php:
<?php
echo "with GET<br>";
echo "my first param is: ".$_GET['param1']."<br>";
echo "my second param is: ".$_GET['param2']."<br>";
?>
send.php:
<?php
$url = "http://localhost/~php/recieve.php?param1=1¶m2=2";
$opts = array('http' => array('method' => "GET"));
$context = stream_context_create($opts);
echo "before fopen<br>";
$fp = fopen($url, "r", true, $context);
fpassthru($fp);
fclose($fp);
?>
Expected result:
----------------
before fopen
with GET
my first param is: 1
my second param is: 2
Actual result:
--------------
before fopen
Warning: fopen(http://localhost/~php/recieve.php?param1=1÷m2=2):
failed to open stream: HTTP request failed! ñ¤ö^ in
/home/php/public_html/send.php on line 6
Warning: fpassthru(): supplied argument is not a valid stream resource
in /home/php/public_html/send.php on line 7
Warning: fclose(): supplied argument is not a valid stream resource in
/home/php/public_html/send.php on line 8
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27401&edit=1