faqts : Computers : Programming : Languages : PHP : Common Problems : Errors

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 6 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes

Entry

A script straight out of manual doesnt work file() with URL the script shown in http://www.php.net/manual/en/function.file.php gives Bad File # etc.

May 11th, 2001 20:42
Philip Olson, Marc D, http://marc.theaimsgroup.com/?l=php-dev


So, you're running php4.0.4 and AIX webserver and after running the 
following code :
 <?php
   $fcontents = file('http://www.php.net/');
   while (list ($line_num, $line) = each ($fcontents)) {
     echo "<b>Line $line_num:</b> ". htmlspecialchars($line) ."<br>\n";
   }
 ?>
You get this following error :
  Warning: file("http://www.php.net/") - Bad file number in
    /path/to/file/file.php on line 6
  Warning: Variable passed to each() is not an array or object in
    /path/to/file/file.php on line 8
See the following open bug report
  http://www.php.net/bugs.php?id=10033
This appears to be AIX specific and hopefully this bug will be squashed 
soon.