php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28973 file_get_contents works in CLI but not in ISAPI.
Submitted: 2004-06-30 13:07 UTC Modified: 2004-07-08 12:04 UTC
From: richard dot quadling at carval dot co dot uk Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.3.7 OS: Windows XP Pro SP1
Private report: No CVE-ID: None
 [2004-06-30 13:07 UTC] richard dot quadling at carval dot co dot uk
Description:
------------
Hi.

I have a script which is used to validate the location of files on another server.

If I upload the script to my ISPs server (an IX of some sort) it works.
If I use run the script from the command line on my pc, it works.
If I run the script from my local web server, it does not.

The code supplied is the critical code. The filename actually comes from a list and is concatenated inside a function.

This method has previously worked!

I use file_get_contents a LOT. Even in this script I use it to retrieve the lists using file_get_contents and it works, but for some reason, this site is (www2.oeri.ath.cx) is not working correctly with ISAPI.

My web server is Sambar.

I have NOT tried a snapshot yet. I am not sure why ISAPI would not work but CLI does.


P.S. How do I produce a backtrace on a Windows version of PHP?


Reproduce code:
---------------
<?php
$sLen = file_get_contents('http://www2.oeri.ath.cx/richq/check_file.php?url=Chumbawamba%2F1982%2F01+-+Garageland.mp3');
echo $sLen;
?>

Expected result:
----------------
A number indicating the file size, in this case ...

1939853

Actual result:
--------------
Warning: file_get_contents() [function.file-get-contents.html]: php_network_getaddresses: gethostbyname failed in C:\Downloaded Software and personal info\Saved CDs\Archive_002\Flight1721\public_html\proof.php on line 2

Warning: file_get_contents(http://www2.oeri.ath.cx/richq/check_file.php?url=Chumbawamba%2F1982%2F01+-+Garageland.mp3) [function.file-get-contents.html]: failed to open stream: No error in C:\Downloaded Software and personal info\Saved CDs\Archive_002\Flight1721\public_html\proof.php on line 2


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-08 11:41 UTC] sniper@php.net
There is something wrong with your DNS setup (permissions, etc.). Propably the user as with the web server runs as doesn't have some permissions correctly setup (firewall?) but the user as which you run the script on the command line has them correctly set.. Definately not a PHP bug.

 [2004-07-08 12:04 UTC] richard dot quadling at carval dot co dot uk
Aha!

Yes. I run the CLI as me (and I have my gateway/DNS records correct for our network).

The webserver was using the default user (LocalSystem) which did NOT have the correct permissions.

I've changed the logon user for the service to me and all is well.

Now, all I need to do is work out how to set the permissions properly for the LocalSystem user! Or leave it as it is!

Thanks and sorry about the bug report.

Richard.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 09 14:03:33 2021 UTC