Welcome! Log In Create A New Profile

Advanced

[PHP] file_get_contents() problem

Posted by Tedd Sperling 
Tedd Sperling
[PHP] file_get_contents() problem
February 25, 2017 07:10PM
Hi guys:

My file_get_contents() demo has stopped working on the school's server, please review:

http://citw.lcc.edu/~sperlt/citw185/examples/content.php

It did work (since 2009), but no longer works. I have tried the exact same code on other sites and it does work. But I don’t have an explanation as to why it doesn’t work on this site. Anyone care to comment?

Thanks,

tedd

_______________
tedd sperling
tedd@sperling.com






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Narcis Garcia
Re: [PHP] file_get_contents() problem
February 25, 2017 07:20PM
PHP version?
Web server?
What is the "no longer works" appearance?


El 25/02/17 a les 19:00, Tedd Sperling ha escrit:
> Hi guys:
>
> My file_get_contents() demo has stopped working on the school's server, please review:
>
> http://citw.lcc.edu/~sperlt/citw185/examples/content.php
>
> It did work (since 2009), but no longer works. I have tried the exact same code on other sites and it does work. But I don’t have an explanation as to why it doesn’t work on this site. Anyone care to comment?
>
> Thanks,
>
> tedd
>
> _______________
> tedd sperling
> tedd@sperling.com
>
>
>
>
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Aziz Saleh
Re: [PHP] file_get_contents() problem
February 25, 2017 07:20PM
On Sat, Feb 25, 2017 at 1:12 PM, Narcis Garcia <[email protected]>
wrote:

> PHP version?
> Web server?
> What is the "no longer works" appearance?
>
>
> El 25/02/17 a les 19:00, Tedd Sperling ha escrit:
> > Hi guys:
> >
> > My file_get_contents() demo has stopped working on the school's server,
> please review:
> >
> > http://citw.lcc.edu/~sperlt/citw185/examples/content.php
> >
> > It did work (since 2009), but no longer works. I have tried the exact
> same code on other sites and it does work. But I don’t have an explanation
> as to why it doesn’t work on this site. Anyone care to comment?
> >
> > Thanks,
> >
> > tedd
> >
> > _______________
> > tedd sperling
> > tedd@sperling.com
> >
> >
> >
> >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Insure this setting is correct:

http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

Without it you won't be able to do external URLs.
Ryan Pallas
Re: [PHP] file_get_contents() problem
February 25, 2017 07:20PM
My guess is that allow_url_fopen is not enabled. See
http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

It's a wild guess considering you don't provide much information about the
problem, if there are any errors in logs or such.

On Sat, Feb 25, 2017 at 11:00 AM, Tedd Sperling <[email protected]> wrote:

> Hi guys:
>
> My file_get_contents() demo has stopped working on the school's server,
> please review:
>
> http://citw.lcc.edu/~sperlt/citw185/examples/content.php
>
> It did work (since 2009), but no longer works. I have tried the exact same
> code on other sites and it does work. But I don’t have an explanation as to
> why it doesn’t work on this site. Anyone care to comment?
>
> Thanks,
>
> tedd
>
> _______________
> tedd sperling
> tedd@sperling.com
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Adam Jon Richardson
Re: [PHP] file_get_contents() problem
February 25, 2017 08:00PM
On Sat, Feb 25, 2017 at 1:00 PM, Tedd Sperling <[email protected]> wrote:

> Hi guys:
>
> My file_get_contents() demo has stopped working on the school's server,
> please review:
>
> http://citw.lcc.edu/~sperlt/citw185/examples/content.php


I usually first check the allow_url_fopen setting when this stops working
on a server, as file_get_contents needs this turned on to access URLs:
http://php.net/manual/en/filesystem.configuration.php

Adam
Jeffry Killen
Re: [PHP] file_get_contents() problem
February 25, 2017 10:40PM
> On Feb 25, 2017, at 10:56 AM, Adam Jon Richardson <[email protected]> wrote:
>
> On Sat, Feb 25, 2017 at 1:00 PM, Tedd Sperling <[email protected]> wrote:
>
>> Hi guys:
>>
>> My file_get_contents() demo has stopped working on the school's server,
>> please review:
>>
>> http://citw.lcc.edu/~sperlt/citw185/examples/content.php
>

Just a wild guess... what are the permissions on the file(s) your trying to read?
Could they have been inadvertently changed to deny access, although I
presume you would get an error message if that were the case.

JK
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Tedd Sperling
Re: [PHP] file_get_contents() problem [Solved]
February 27, 2017 03:30PM
Hi guys:

I checked with the college after everyone on the PHP list commented and it indeed was an option set wrong.

The school IT replied:

> Yes it looks like with the last PHP update the system set the allow_url_fopen to disable, which is weird since it’s a commonly enabled by default config.


Thanks everyone.

Cheers,

tedd
_______________
tedd sperling
tedd@sperling.com






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login