Jump to content

Recommended Posts

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.
Link to comment
https://forums.phpfreaks.com/topic/13134-enabling-url-file-access/
Share on other sites

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

Try a relative path instead if the file is on your server. or see if you can turn on [b]allow_url_fopen[/b] setting in the php.ini. Also GoDaddy may have safe_mode trun one which may be causing this.
[!--quoteo(post=388931:date=Jun 28 2006, 01:09 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 28 2006, 01:09 PM) [snapback]388931[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Try a relative path instead if the file is on your server. or see if you can turn on [b]allow_url_fopen[/b] 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?
You said you had access to your php.ini? You just open it up and find the line that says [i]allow_url_fopen = Off[/i] to [i]allow_url_fopen = On[/i]
It may not state Off it might be set to 0 instead.

Additonally you might be able to use the following in your script:
[code]// enable url fopen
ini_set("allow_url_fopen", "On");[/code]
[!--quoteo(post=388972:date=Jun 28 2006, 02:37 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 28 2006, 02:37 PM) [snapback]388972[/snapback][/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 [i]allow_url_fopen = Off[/i] to [i]allow_url_fopen = On[/i]
It may not state Off it might be set to 0 instead.

Additonally you might be able to use the following in your script:
[code]// enable url fopen
ini_set("allow_url_fopen", "On");[/code]
[/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?
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.