Jump to content

Archived

This topic is now archived and is closed to further replies.

clarencek

Enabling Url File Access?

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
[!--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?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
[!--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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.