php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42953 file_get_contents() doesn't work anymore with FastCGI on iPlanet 6.1 SP8
Submitted: 2007-10-12 19:45 UTC Modified: 2007-10-22 19:54 UTC
From: chcaron at nrcan dot gc dot ca Assigned:
Status: Closed Package: iPlanet related
PHP Version: 5CVS-2007-10-12 (snap) OS: Solaris 5.8
Private report: No CVE-ID: None
 [2007-10-12 19:45 UTC] chcaron at nrcan dot gc dot ca
Description:
------------
We have a site that calls file_get_contents() to retrieve data from another file in the same site and display it on the screen.

It used to work correctly when we used the NSAPI PHP. Now that we went to FastCGI, it doesn't work anymore, except if "b.php" is sitting on another site, on the same server or another one.

I could reproduce the bug with 4.4.7, 5.2.4 and the latest 5.2 snapshot (before you ask to try).

PHP was compiled with the following:
./configure --prefix=/usr/local/php-5.2-snap --enable-fastcgi --disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear

It is Sun Java System Web Server (formely known as iPlanet, or SunONE) 6.1 SP8 with the Sun's FastCGI plugin (http://www.sun.com/download/products.xml?id=42d693c3).

Reproduce code:
---------------
a.php contains:

<?php
$url="http://servername/b.php";
$file = file_get_contents($url);
echo $file;
?>

b.php contains:

<?
print "Hello World!";
?>

Expected result:
----------------
While browsing to http://servername/a.php, I should see:

Hello World!

Actual result:
--------------
Warning: file_get_contents(http://servername/b.php) [function.file-get-contents]: failed to open stream: HTTP request failed! in /www/servername/a.php on line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-15 10:18 UTC] jani@php.net
Can you please try the same but using lighttpd so that we can rule out any iPlanet issue? (note: I can't reproduce this using FastCGI on Apache or Lighttpd) And are you sure there isn't any permission issue, such as firewall or something like that? Try running the same script using PHP CLI binary. (And under same user as the fastcgi processes run as)
 [2007-10-15 15:50 UTC] chcaron at nrcan dot gc dot ca
It is definitely not a firewall/permission issue, but it could be iPlanet or FastCGI module (from Sun?) related.

The command line PHP works great for 5.2.x, but not for 4.4.7:

nrn7# /usr/local/php-4.4.7/bin/php a.php

Warning: file_get_contents(http://servername/b.php): failed to open stream: HTTP request failed!  in /www/servername/a.php on line 4

nrn7# /usr/local/php-5.2.4/bin/php a.php
Hello World!

nrn7# /usr/local/php-5.2-snap/bin/php a.php
Hello World!

I can't test it on lighttpd or Apache (it has to work with iPlanet).
 [2007-10-17 12:51 UTC] jani@php.net
I have also some problem with file_get_contents() doing a request from same server. For me it just hangs though.
 [2007-10-18 14:25 UTC] jani@php.net
My problem was with sessions, I had not used session_write_close() in right place. So it's not related to this.
 [2007-10-22 19:54 UTC] chcaron at nrcan dot gc dot ca
Too many problems with FastCGI (files from Sun are dating from 2005, so I don't think they're updated often...). We went back to NSAPI and it works ok again. You can close that bug as we won't be able to test it anymore.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC