2

I have to website with a very similar php configuration (actually on the same hosting account), with almost identical php code and with identical file structure. At some point, I call fopen(http://example.com/rssfedd.xml) to retrieve a RSS feed.

on http://sfdmorin.com/accueil/index.php everything works fine, on http://danielpoiriergda.ca/accueil/index.php i get:

Warning: fopen(http://affaires.lapresse.ca/rss/2399.xml) [function.fopen]: failed to open stream: Permission denied in /var/www/vhosts/danielpoiriergda.ca/httpdocs/snippet/lastRSS.php on line 143

  $f = fopen("http://affaires.lapresse.ca/rss/2399.xml", 'r');

Both website have php debug mode enabled and both have the same permissions for file and folders. Both info.php have *allow_url_fopen* enabled for local and master value

Here are the major differences I found on both phpinfo() file:

not working site: Server API CGI/FastCGI

working site: Server API Apache 2.0 Handler

and on the working site there are no php.ini file in the path given by the loaded configuration file field

EDIT: I know this thread is probably dead, but not the problem. I check, with Netbeans fill diff, all the PHP code and php.ini are exactly the same on both domain.

I know similar questions were ask, but they did not help me. Thank you!

4
  • Check if safe_mode is turned on, this disables allow_url_fopen Commented Jul 25, 2012 at 15:34
  • safe_mode was on. I tried turning it off and it still did not work Commented Jul 25, 2012 at 15:44
  • Check my comment again, "this disables allow_url_fopen", ask your hoster to turn it off - if they won't (why else did they switch it on?) then start using cURL to grab files for you... check it is installed though. Commented Jul 25, 2012 at 16:09
  • Maybe a firewall-related issue? Commented Aug 7, 2012 at 23:56

1 Answer 1

4

Finally, I contacted my webserver tech support and they solve the problem. They did by:

adding an exception to SELinux

I dont have a clue wwhat SELinux is or what they did specificaly.

Sign up to request clarification or add additional context in comments.

1 Comment

Bumping an old thread here, but figured I'd comment on what they actually did. There is a flag in SELinux called "httpd_can_network_connect" which is set to Off by default. It needs to be set to on. Use getsebool -a | grep http to find what yours is. If it's set to Off, use setsebool -P httpd_can_network_connect on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.