By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,827 Members | 1,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,827 IT Pros & Developers. It's quick & easy.

PHP 4.3.4.4

P: n/a
I am new to all this testing server terminolgy. For the last 6 days I have
read everything I can find on installing php/mysql, IIS as a testing server.

IIS, MySQL, PHP installed and apparently working but since I have never had
any experience with any of them I can't be sure.

WinXP Pro
IIS
PHP 4.3.4.4

I am on chapter 2 of Welling and Thompson PHP and MySQL book which is for an
earlier version of php.

Once I discovered this I was able to change some of the ini settings to get
it working.

There are two pages I am working with entered as called for in the book:
orderform.htm and processorder.php

The submit buttom calls the processorder.php and executes the php
statements, sets the variables, echo to the screen preforms calucations
etc., until I get to the fopen() function and I get the message below.

Warning: fopen(http://localhost/phptest/orderfile/orders.txt): failed to
open stream: HTTP wrapper does not support writeable connections. in
c:\inetpub\wwwroot\phptest\processorder.php on line 56

Warning: flock(): supplied argument is not a valid stream resource in
c:\inetpub\wwwroot\phptest\processorder.php on line 57

Your order could not be processed at this time. Please try again later.

The relevant code section:

$outputstring = $date."\t".$tyreqty." tyres \t".$oilqty." oil\t"
.$sparkqty." spark plugs\t\$".$total
."\t". $address."\n";

// open file for appending
$fp = fopen("http://localhost/phptest/orderfile/orders.txt", "a+");
flock($fp, 2);
{
echo "<p><strong> Your order could not be processed at this time. "
."Please try again later.</strong></p></body></html>";
exit;
}

fwrite($fp, $outputstring);
flock($fp, 3);
fclose($fp);

echo "<p>Order written.</p>";

?>

In the IIS console I selected the phptest/orderfile folder and checked read
and write.

I have read the help on stream and it makes no sense to me at all.

I am totally frustrated at this point. I have been going around in circles
and am no closer to getting the problem soved than I was 6 days ago.

Any advice, suggestions, links etc will be greatly appreciated.

Bert


Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Bert" <be*********@meckcom.net> wrote in
news:fN****************@fe07.usenetserver.com:
Warning: fopen(http://localhost/phptest/orderfile/orders.txt): failed
to open stream: HTTP wrapper does not support writeable connections.
in c:\inetpub\wwwroot\phptest\processorder.php on line 56
That's because you weren't actually opening a file there; you were asking
your Web server to fetch a resource and return its contents to you. You
need to specify a filesystem path, not a URL, and not specify a protocol.
Warning: flock(): supplied argument is not a valid stream resource in
c:\inetpub\wwwroot\phptest\processorder.php on line 57


That's because your fopen() failed, so the result it returned wasn't a
valid file handle.
Jul 17 '05 #2

P: n/a
Hi Eric,

Any possibility you could provide sample code for the fopen() call?

Bert

"Eric Bohlman" <eb******@earthlink.net> wrote in message
news:Xn*******************************@130.133.1.4 ...
"Bert" <be*********@meckcom.net> wrote in
news:fN****************@fe07.usenetserver.com:
Warning: fopen(http://localhost/phptest/orderfile/orders.txt): failed
to open stream: HTTP wrapper does not support writeable connections.
in c:\inetpub\wwwroot\phptest\processorder.php on line 56


That's because you weren't actually opening a file there; you were asking
your Web server to fetch a resource and return its contents to you. You
need to specify a filesystem path, not a URL, and not specify a protocol.
Warning: flock(): supplied argument is not a valid stream resource in
c:\inetpub\wwwroot\phptest\processorder.php on line 57


That's because your fopen() failed, so the result it returned wasn't a
valid file handle.


Jul 17 '05 #3

P: n/a
"Bert" <be*********@meckcom.net> wrote in
news:0k***************@fe07.usenetserver.com:
"Eric Bohlman" <eb******@earthlink.net> wrote in message
news:Xn*******************************@130.133.1.4 ...
"Bert" <be*********@meckcom.net> wrote in
news:fN****************@fe07.usenetserver.com:
> Warning: fopen(http://localhost/phptest/orderfile/orders.txt):
> failed to open stream: HTTP wrapper does not support writeable
> connections. in c:\inetpub\wwwroot\phptest\processorder.php on line
> 56
That's because you weren't actually opening a file there; you were
asking your Web server to fetch a resource and return its contents to
you. You need to specify a filesystem path, not a URL, and not
specify a protocol.

Hi Eric,

Any possibility you could provide sample code for the fopen() call?


No, because I have no idea where in your filesystem "orders.txt" is being
stored; there's *no* necessary relation between a URL path and a filesystem
path. Take the actual filesystem path and put it (enclosed in quotes) in
your fopen call in place of the stuff that starts with "http".

Jul 17 '05 #4

P: n/a
Eric,

Thanks a million. You have made my day.

I knew it had to be something simple but had no idea what I was doing wrong.

You don't know how much I appreciate you and the others that help us dummies
out.

Thanks again,

Bert
"Eric Bohlman" <eb******@earthlink.net> wrote in message
news:Xn*******************************@130.133.1.4 ...
"Bert" <be*********@meckcom.net> wrote in
news:0k***************@fe07.usenetserver.com:
"Eric Bohlman" <eb******@earthlink.net> wrote in message
news:Xn*******************************@130.133.1.4 ...
"Bert" <be*********@meckcom.net> wrote in
news:fN****************@fe07.usenetserver.com:

> Warning: fopen(http://localhost/phptest/orderfile/orders.txt):
> failed to open stream: HTTP wrapper does not support writeable
> connections. in c:\inetpub\wwwroot\phptest\processorder.php on line
> 56

That's because you weren't actually opening a file there; you were
asking your Web server to fetch a resource and return its contents to
you. You need to specify a filesystem path, not a URL, and not
specify a protocol.
Hi Eric,

Any possibility you could provide sample code for the fopen() call?


No, because I have no idea where in your filesystem "orders.txt" is being
stored; there's *no* necessary relation between a URL path and a

filesystem path. Take the actual filesystem path and put it (enclosed in quotes) in
your fopen call in place of the stuff that starts with "http".


Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.