Re: file_get_contents() failing on CentOS.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30 September 2010 20:27, Adam Richardson <simpleshot@xxxxxxxxx> wrote:
> On Thu, Sep 30, 2010 at 5:02 AM, Richard Quadling <rquadling@xxxxxxxxx>
> wrote:
>>
>> Hi.
>>
>> I'm trying to help a friend with a CentOS setup.
>>
>> He's installed PHP and SOAP using yum install php-soap and he is
>> having problems.
>>
>> I assisted in the developed the php script he is using and it is
>> working fine on Windows.
>>
>> In testing, we can do ...
>>
>> # wget http://www.php.net
>>
>> but not ...
>>
>> # php -r "echo file_get_contents('http://www.php.net');"
>> PHP Warning: Âfile_get_contents(http://www.php.net): failed to open
>> stream: HTTP request failed! Âin Command line code on line 1
>>
>>
>> I've checked allow_url_fopen and that is set to 1
>>
>> As a test ...
>>
>> # php -d allow_url_fopen=1 -r "echo
>> file_get_contents('http://www.php.net');"
>> PHP Warning: Âfile_get_contents(http://www.php.net): failed to open
>> stream: HTTP request failed! Âin Command line code on line 1
>> (This works fine on windows system)
>>
>> # php -d allow_url_fopen=0 -r "echo
>> file_get_contents('http://www.php.net');"
>> PHP Warning: Âfile_get_contents(): URL file-access is disabled in the
>> server configuration in Command line code on line 1
>> PHP Warning: Âfile_get_contents(http://www.php.net): failed to open
>> stream: no suitable wrapper could be found in Command line code on
>> line 1
>>
>> Neither will actually return the contents.
>>
>> Considering wget works and PHP doesn't _AND_ that this is linux, I'm lost.
>>
>> Wireshark shoes no communication at all when PHP is used to try and
>> get to www.php.net, but it does show everything accurately when using
>> wget.
>>
>> I've got the output of php -i and of the debug data from wget.
>>
>> So. Any pointers, suggestions, things to read/try/etc.
>>
>> Regards,
>>
>> Richard.
>>
>> --
>> Richard Quadling
>> Twitter : EE : Zend
>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> Some firewalls used to take exception to file_get_contents() requests whilst
> still allowing some http requests, and if I recall correctly, CentOS uses a
> pretty old version of PHP, so perhaps it's worth checking out:
> bugs[dot]php[dot]net/bug[dot]php?id=40197
> A shot in the dark.
> Adam
> P.S. - The link kept getting my reply marked as spam. ÂThat pesky little
> php.net ;)
>
> --
> Nephtali:Â PHP web framework that functions beautifully
> http://nephtaliproject.com
>

Thanks for that. I've passed the details on.

OOI, wget uses HTTP/1.1 ...

---request begin---
GET / HTTP/1.0
User-Agent: Wget/1.11.4 Red Hat modified
Accept: */*
Host: www.php.net
Connection: Keep-Alive


The bug report certainly matches the behaviour.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux