Jump to content

Recommended Posts

Warning: fopen(res:///PHP/C:\): failed to open stream: No such file or directory in *\server.exe on line 19
Warning: fread(): supplied argument is not a valid stream resource in *\server.exe on line 20
Warning: fclose(): supplied argument is not a valid stream resource in *\server.exe on line 21

And $header[1] is:

/index.html

 

I get those things when I use the following code:

 

**CODE SNIPPED**

$input="";$output="";$header="";$request="";$value="";$path="C:/";
$input = socket_read($spawn, 1024) or die("Could not read input\n");
$input = trim($input); $request = split("[\n\r\t]+", $input);
$header = split("[ ]+", $request);

if ($header[1]=="/") { print "\n User Requested /"; }
foreach ($request as $value) { $totalvar .="\t".$value; }

$f = fopen($path.$header[1],"r");
$output = fread($f,filesize($path.$header[1]));
fclose($f);

**CODE SNIPPED**

 

and my web browser acessing the web server returns:

 

The webpage did not respond.

 

Uh, so why do I get these?  Why does it add "res:///PHP/" befroe the request?

Link to comment
https://forums.phpfreaks.com/topic/68519-fopen-problem/
Share on other sites

Warning: fopen(res:///PHP/C:\): failed to open stream: No such file or directory in *\server.exe on line 19
Warning: fread(): supplied argument is not a valid stream resource in *\server.exe on line 20
Warning: fclose(): supplied argument is not a valid stream resource in *\server.exe on line 21

And $header[1] is:

/index.html

I get those things when I use the following code:

**CODE SNIPPED**

$input="";$output="";$header="";$request="";$value="";$path="C:/";
$input = socket_read($spawn, 1024) or die("Could not read input\n");
$input = trim($input); $request = split("[\n\r\t]+", $input);
$header = split("[ ]+", $request);

if ($header[1]=="/") { print "\n User Requested /"; }
foreach ($request as $value) { $totalvar .="\t".$value; }

$f = fopen($path.$header[1],"r");
$output = fread($f,filesize($path.$header[1]));
fclose($f);

**CODE SNIPPED**

and my web browser acessing the web server returns:

The webpage did not respond.

Uh, so why do I get these?  Why does it add "res:///PHP/" befroe the request?

Link to comment
https://forums.phpfreaks.com/topic/68519-fopen-problem/#findComment-344413
Share on other sites

since you guys are being so "nice" il give you more information

 

GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
Accept-Language: en-US
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
Host: 127.0.0.1
Connection: Keep-Alive

is another example request to the server.  I am trying to get the first line "GET / HTTP/1.1".  I seperated it so each line is its own value $request[num] and each space seperated on line 1 is $header[num][

 

ALSO:

 

[09-09-07_9:53:10]	GET / HTTP/1.1	Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*	Accept-Language: en-US	UA-CPU: x86	Accept-Encoding: gzip, deflate	User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)	Host: 127.0.0.1	Connection: Keep-Alive\w	

is what my server logged :D  it has good advanced logging.

Link to comment
https://forums.phpfreaks.com/topic/68519-fopen-problem/#findComment-344528
Share on other sites

How much more information do I need before I can get help!?!?!?!?

 

uh.. php 4.4.4 using bambalam php compiler, im using windows xp vs.8987465765456497 compilation 2600

 

here is sysinfo:

 

OS Name	Microsoft Windows XP Professional
Version	5.1.2600 Service Pack 2 Build 2600
OS Manufacturer	Microsoft Corporation
System Name	INDRA
System Manufacturer	INTEL_
System Model	D845GVSR
System Type	X86-based PC
Processor	x86 Family 15 Model 2 Stepping 9 GenuineIntel ~2666 Mhz
BIOS Version/Date	Intel Corp. VA84510A.86A.0023.P08.0309261501, 26/09/2003
SMBIOS Version	2.3
Windows Directory	C:\WINDOWS
System Directory	C:\WINDOWS\system32
Boot Device	\Device\HarddiskVolume1
Locale	Canada
Hardware Abstraction Layer	Version = "5.1.2600.2562 (xpsp.040919-1030)"
User Name	INDRA\Administrator
Time Zone	Pacific Daylight Time
Total Physical Memory	256.00 MB
Available Physical Memory	55.75 MB
Total Virtual Memory	2.00 GB
Available Virtual Memory	1.95 GB
Page File Space	2.23 GB
Page File	C:\pagefile.sys

 

I use a shitty computer to program incase I screw somehting up.

Link to comment
https://forums.phpfreaks.com/topic/68519-fopen-problem/#findComment-344538
Share on other sites

lol ok my problem is that I get random errors hwen I try to fopen..

 

I am makingg a web server and it reads the file based on the persons request

 

it adds res:///PHP/ before the filename and this scrwes up the whole request.

 

WHY DOES FOPEN ADD RES:///PHP/ BEFORE THE FILE ENTRY?  (PHP 4.4.4)

Link to comment
https://forums.phpfreaks.com/topic/68519-fopen-problem/#findComment-344602
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.