[PHP] 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 pUsing FOPEN with DNS: ; $file = fopen (http://www.somesite.com/test.txt;, r); if (!$file) { echo pUnable 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
Re: [PHP] Re: PHP Failing to open remote files using include/require
Mikey wrote: Have you looked at your allow_url_fopen setting in php.ini? It should be on... That was the first thing I checked and both values are on. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using headers to download a file takes too long
Hi, I'm writing a few scripts that allows users to download files, some around 45MB+. The files are stored outside the webroot, for security reasons, so when the user clicks on the link, this called my downloadFile.php script, this script accesses the requested files, using the path relative to the top of the actual file system, then outputs the correct headers for the mimetype and file length (to assist in the download box status time), for small files, then this is really quick and works great, yet for files from say 10MB or more, it takes around a minute before the download box even pops up. I've tried using readfile and fread, to access the files, yet both seem to take the same amount of time, it would seem like they are getting buffered, or maybe read into memory, before they are allowed to be downloaded, basically I'm trying to reproduce the same effect of having the file in the webroot and creating a simple href to the actual file (using this method, would show the location of the files, this is what I'm trying to avoid). Can anyone advise me on what I may be doing wrong, code examples can be supplied if required. Cheers in advance Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php