Jump to content

Trying to open URL. [function.fopen]: failed to open stream: Permission denied


ttocskcaj

Recommended Posts

Check your phpinfo() output and make sure that allow_url_fopen is enabled.

 

If it is and you still get the error, then you are probably running on a SELinux setup which disables php's ability to open sockets when run under apache.  You either need to change the SELinux configuration to allow that or disable SELinux all together.  Some google searches should turn up the howto for each of those options.

 

Link to comment
Share on other sites

PHP Manual said this:

If PHP has decided that filename specifies a local file, then it will try to open a stream on that file. The file must be accessible to PHP, so you need to ensure that the file access permissions allow this access. If you have enabled safe mode, or open_basedir further restrictions may apply. 

 

So if safe_mode or oben_basedir is enabeld then you'll have some issues and there are some workarounds, though I think if safe mode is on you'll get an error specific to that.. Also, please double check your permissions, I don't think it is likely that this issue is related to actual code. It's most likely going to have to do with permissions, just like the error states.

 

This is of course in addition to kickens post, so start of with what he suggested.

Link to comment
Share on other sites

If it is and you still get the error, then you are probably running on a SELinux setup which disables php's ability to open sockets when run under apache.  You either need to change the SELinux configuration to allow that or disable SELinux all together.  Some google searches should turn up the howto for each of those options.

 

You were right. SELinux was blocking apache from network access. Running this command fixed it.

 

# /usr/sbin/setsebool -P httpd_can_network_connect 1

 

Link to comment
Share on other sites

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.