问题描述
我必须使用非常相似的php配置(实际上在同一托管帐户上),具有几乎相同的php代码和相同的文件结构的网站.在某个时候,我调用 fopen(http://example.com/rssfedd.xml)来检索RSS提要.
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.
在 http://sfdmorin.com/accueil/index.php 上一切正常,在 http://danielpoiriergda.ca/accueil/index.php 上,我得到了:
on http://sfdmorin.com/accueil/index.php everything works fine, on http://danielpoiriergda.ca/accueil/index.php i get:
$f = fopen("http://affaires.lapresse.ca/rss/2399.xml", 'r');
两个网站都启用了php调试模式,并且都具有与文件和文件夹相同的权限.两个info.php均已 * allow_url_fopen *启用以获取本地值和主值
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
以下是我在两个phpinfo()文件中发现的主要区别:
Here are the major differences I found on both phpinfo() file:
不起作用的站点:Server API CGI/FastCGI
not working site: Server API CGI/FastCGI
工作站点:服务器API Apache 2.0处理程序
working site: Server API Apache 2.0 Handler
并且在工作站点上,已加载的配置文件字段给出的路径中没有php.ini文件
and on the working site there are no php.ini file in the path given by the loaded configuration file field
我知道此线程可能已死,但不是问题.我用Netbeans fill diff来检查,两个域上的所有PHP代码和php.ini是否完全相同.
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!
推荐答案
最后,我联系了我的Web服务器技术支持,他们解决了该问题.他们的做法是:
Finally, I contacted my webserver tech support and they solve the problem. They did by:
我不知道SELinux是什么或他们具体做了什么.
I dont have a clue wwhat SELinux is or what they did specificaly.
这篇关于PHP-fopen($ url)无法打开流:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!