Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php_hostconnect problem

Status
Not open for further replies.

chrisw669

Technical User
Feb 19, 2002
43
US
When I call the following script ::

$filename = "$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
echo $contents;

I get ::
Warning: php_hostconnect: connect failed in /web/holden/fread.php on line 4
........

But when I change the script to ::

$filename = "index.html";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
echo $contents;

it works???

I'm running PHP4.0.6/Apache on a RS/6000 AIX4.3.3
I've set file perms to 777 on all files and dirs.
Is there something in php.ini to config or am I
doing something else wrong???

thanks
 
hi chrisw669 ,

the filename in this case sould be either relative path or the path of ur root of linux and not according to ur web server.

so if ur php page is in directory say php and the file ur reading is in html dir at the same level then
$filename = "../html/index.html"


cheers

spookie
 
I follow what your saying but in the past (on a different server anyways) i've been able to open and now i can't. it give me the same error that i ran locally. the only thing i can figure is that it's a config problem. just don't know where to look.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top