Have you looked at your "allow_url_fopen" setting in php.ini? It should be on...
HTH, Mikey ----- Original Message ----- From: "Mark Cooke" <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]> Sent: Thursday, September 23, 2004 3:04 PM Subject: PHP Failing to open remote files using include/require > Hi, > > I have a server hosted by a company running Win2k, they are in charge of > the maintainance, and we had a site working fine, then yesterday, it > failed to include any files using http:// using: > include ("http://".$_SERVER['SERVER_NAME']."/dir/somefile.php"); > > The code has not been altered in 2 weeks, and as mentioned it was > working the other day, all other php code and include works. > > There is no firewall or other apps in place that is stopping the box > from doing external calls, there is also not a DNS problem. > > They are running php 4.3.2, and the php.ini has not been touched in 4 > months. > > I've installed a quick test script, below: > > * name and IP addresses have been changed * > > [code] > echo "Test One: "; > include_once '../../test.txt'; > > echo "External Call using DNS: "; > include_once 'http://www.somesite.com/test.txt'; > > echo "External Call NOT using DNS: "; > include_once 'http://0.0.0.0/test.txt'; > > > echo "<p>Using FOPEN with DNS: "; > $file = fopen ("http://www.somesite.com/test.txt", "r"); > if (!$file) { > echo "<p>Unable to open remote file.\n"; > exit; > } > > while (!feof ($file)) { > $line = fgets ($file, 1024); > > echo $line; > } > fclose($file); > > [/code] > > This is the output: > > Test One: --- a test file --- (This is ok) > > External Call using DNS: > Warning: main(): Failed opening 'http://www.somesite.com/test.txt' for > inclusion (include_path='.;c:\php4\pear') in > D:\Inetpub\ftproot\somedir\dir\test.php on line 8 > > External Call NOT using DNS: > Warning: main(): Failed opening 'http://0.0.0.0/test.txt' for inclusion > (include_path='.;c:\php4\pear') in > D:\Inetpub\ftproot\somedir\dir\test.php on line 12 > > Using FOPEN with DNS: --- a test file --- (This is ok) > > > This is driving me mad, as scripts do not just stop working like this, > it would seem to me, that some MS patch or something else has changed on > the serverthat is causing the problem. > > Any help wwould be most appreiated. > > Using the same code, it works on 3 development servers here (at work, > using Win2k, Linux and Windows 2003), and they all run different > versions of php. > > Regards > > Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php