Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

w2ksp4.exe, WwwxxXdbf, procmail "FROM_MAILER" patch, Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF

Links

XODOX
Impressum

#1: file_get_contents() failing on CentOS.

Posted on 2010-09-30 11:02:39 by Richard Quadling

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

Report this message

#2: Re: file_get_contents() failing on CentOS.

Posted on 2010-10-01 00:05:21 by Richard Quadling

On 30 September 2010 20:27, Adam Richardson <simpleshot@gmail.com> wrote:
> On Thu, Sep 30, 2010 at 5:02 AM, Richard Quadling <rquadling@gmail.com>
> 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=3D1 -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=3D0 -r "echo
>> file_get_contents('http://www.php.net');"
>> PHP Warning:  file_get_contents(): URL file-access is disabled in t=
he
>> 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 los=
t.
>>
>> 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 whi=
lst
> 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=3D40197
> A shot in the dark.
> Adam
> P.S. - The link kept getting my reply marked as spam.  That pesky li=
ttle
> 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.

--=20
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

Report this message

#3: Re: file_get_contents() failing on CentOS.

Posted on 2010-10-01 17:19:27 by kranthi

probably not the issue, but is the php engine behind a proxy server ?
wget uses the environment variable, but PHP does not

Kranthi.
http://goo.gl/e6t3

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

Report this message

#4: Re: file_get_contents() failing on CentOS.

Posted on 2010-10-04 11:45:41 by Richard Quadling

On 1 October 2010 16:19, kranthi <kranthi117@gmail.com> wrote:
> probably not the issue, but is the php engine behind a proxy server ?
> wget uses the environment variable, but PHP does not
>
> Kranthi.
> http://goo.gl/e6t3
>

Hopefully getting a reply today on this.

What env_var is used by wget?

--
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

Report this message

#5: Re: file_get_contents() failing on CentOS.

Posted on 2010-10-04 11:48:06 by kranthi

http_proxy or HTTP_PROXY i m not sure

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

Report this message

#6: Re: file_get_contents() failing on CentOS.

Posted on 2010-10-04 12:24:35 by Richard Quadling

On 4 October 2010 10:48, kranthi <kranthi117@gmail.com> wrote:
> http_proxy or HTTP_PROXY i m not sure
>

Thanks. Passing it on (and learning a bit).

--
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

Report this message

#7: Re: file_get_contents() failing on CentOS.

Posted on 2010-10-04 12:51:47 by Richard Quadling

On 4 October 2010 11:24, Richard Quadling <rquadling@gmail.com> wrote:
> On 4 October 2010 10:48, kranthi <kranthi117@gmail.com> wrote:
>> http_proxy or HTTP_PROXY i m not sure
>>
>
> Thanks. Passing it on (and learning a bit).

http://docs.php.net/manual/en/function.stream-context-get-de fault.php#72086

Could help to some degree. Not sure if SOAPClient will go through the
context, though there is a 'stream_context' parameter that can be set
....

All passed on.
--
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

Report this message

#8: Re: file_get_contents() failing on CentOS.

Posted on 2010-10-04 13:52:26 by kranthi

and if proxxy is the issue http://proxychains.sf.net/ will help

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

Report this message

#9: Re: file_get_contents() failing on CentOS.

Posted on 2010-10-05 12:56:03 by Richard Quadling

The issue _WAS_ the firewall.

All sorted.

Thank you.

--
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

Report this message

#10: Re: file_get_contents() failing on CentOS.

Posted on 2010-10-05 17:35:03 by Adam Richardson

--0015174c192e96b3500491e067e6
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Oct 5, 2010 at 6:56 AM, Richard Quadling <rquadling@gmail.com>wrote:

> The issue _WAS_ the firewall.
>
> All sorted.
>
> Thank you.
>
>
Glad he got it working.

Adam

--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com

--0015174c192e96b3500491e067e6--

Report this message