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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Failed to Open Stream

Status
Not open for further replies.

jmg498

Technical User
Oct 31, 2007
26
0
0
US
All of a sudden I'm getting the following errors when trying to execute a script:

Code:
Warning: fopen() [function.fopen]: connect() failed: Permission denied in /home/[URL unfurl="true"]www/jmg498.freehostia.com/radar/crrdr.php[/URL] on line 51

Warning: fopen(ftp://tgftp.nws.noaa.gov/SL.us008001/DF.of/DC.radar/DS.p37cr/SI.kpbz/sn.last) [function.fopen]: failed to open stream: Permission denied in /home/[URL unfurl="true"]www/jmg498.freehostia.com/radar/crrdr.php[/URL] on line 51

And, just for reference, line 51 is:

Code:
$crdat = fopen( "ftp://tgftp.nws.noaa.gov/SL.us008001/DF.of/DC.radar/DS.p37cr/SI.".$rregi.$radar."/sn.last" , "r" ) or die($lerro);

This worked fine up until a couple days ago. The FTP that I'm trying to access works fine when I copy/paste the URL into my browser.

Any ideas? Thanks much!
 
I meant to add...all permissions are set 777.
 
check your php.ini. I suspect that you will find that allow_fopen_url may be set to false.

 
Thanks for your reply. Unfortunately it isn't set to false. Someone else running a similar script is also having problems which is making me think it might be some sort of issue with the file server I'm accessing. Hmmm...
 
can you access the remote server directly using terminal?
 
The free host I'm doing doesn't give me the option to SSH in. I'll give it a shot on my local machine and see what happens.
 
yup. the question was really whether the external server is blocking ftp access. assuming that is clear, we can then investigate whether outbound ftp connections are being blocked by your host. in which case you could always change your server to listen on port 80 since hosts will not typically block outbound port 80 connections. ugly though.
 
Well, the problem still exists even if I use http to access the file I need (the files are stored both on FTP and HTTP). I also verified fopen is set to true.
 
Well, it turns out that it was indeed the host. The site claimed they allowed fopen but it turns out last week they decided to disable it for outgoing connections from their server.

I ended up getting it to work fine when I set it up locally.

Thanks very much for your help! Hopefully they update the site to reflect their decision to change this.

 
try curl instead. you might have more luck with that. or alternatively wget via exec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top