Jump to content


Photo

Enabling Url File Access?


  • Please log in to reply
5 replies to this topic

#1 clarencek

clarencek
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 28 June 2006 - 05:58 PM

Hi, I host with GoDaddy.com and am receiving an error when trying to use the file_get_contents() function:

"Warning: file_get_contents(): URL file-access is disabled in the server configuration"

I know with GoDaddy, I can set up a custome php.ini file. Is that where I can make the changes to enable file-access? I am a newbie so have no idea how to do this. Any help is greatly appreciated.

Thanks.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 June 2006 - 06:09 PM

It looks like you cannot specify a url in the parenthesesis, ie:
file_get_contents("http://www.mysite.co...m/filename.php");

Try a relative path instead if the file is on your server. or see if you can turn on allow_url_fopen setting in the php.ini. Also GoDaddy may have safe_mode trun one which may be causing this.

#3 clarencek

clarencek
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 28 June 2006 - 06:16 PM

[!--quoteo(post=388931:date=Jun 28 2006, 01:09 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 28 2006, 01:09 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Try a relative path instead if the file is on your server. or see if you can turn on allow_url_fopen setting in the php.ini.
[/quote]

So, being the newbie, I'm not even sure how to turn on the allow_url_fopen in the php.ini. Can someone walk me through this please?

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 June 2006 - 07:37 PM

You said you had access to your php.ini? You just open it up and find the line that says allow_url_fopen = Off to allow_url_fopen = On
It may not state Off it might be set to 0 instead.

Additonally you might be able to use the following in your script:
// enable url fopen
ini_set("allow_url_fopen", "On");


#5 clarencek

clarencek
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 28 June 2006 - 08:00 PM

[!--quoteo(post=388972:date=Jun 28 2006, 02:37 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 28 2006, 02:37 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
You said you had access to your php.ini? You just open it up and find the line that says allow_url_fopen = Off to allow_url_fopen = On
It may not state Off it might be set to 0 instead.

Additonally you might be able to use the following in your script:
// enable url fopen
ini_set("allow_url_fopen", "On");
[/quote]

So, the code in the script did not work. I don't have access to the php.ini file, but they allow you to make a custom one. In my custom one, can I just have that one line stating "allow_url_fopen = On"? Or does it need to include a bunch of other stuff?

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 June 2006 - 08:04 PM

You can just put this in your customer php.ini:
allow_url_fopen = On

It may work, it may not. I would expect godaddy probably limits what settings you can changes in your custom php.ini




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users