pec
pec

Reputation: 614

PHP - fopen($url) failed to open stream: Permission denied in

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!

Upvotes: 2

Views: 4250

Answers (1)

pec
pec

Reputation: 614

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.

Upvotes: 4

Related Questions