[英]require_once(“facebook-sdk/facebook.php”) throws a warning “failed to open stream:Permission denied”
I'm trying out the tutorials for Facebook developers. 我正在尝试针对Facebook开发人员的教程。 However, I can't include the Facebook PHP SDK successfully in my code.
但是,我无法在代码中成功包含Facebook PHP SDK。 As stated,
require_once("facebook_sdk/facebook.php");
如前所述,
require_once("facebook_sdk/facebook.php");
throws the following error: 引发以下错误:
Warning: require_once(facebook_sdk/facebook.php) [function.require-once]: failed to
open stream: Permission denied in /opt/lampp/htdocs/awesome/plas.php on line 2
Fatal error: require_once() [function.require]: Failed opening required 'facebook_sdk/facebook.php'
(include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/awesome/plas.php on line 2
I am developing under Lucid Lynx. 我在Lucid Lynx下开发。 I tried doing
chmod 777 facebook.php
but the problem persists. 我尝试做
chmod 777 facebook.php
但问题仍然存在。 I found this SO question but the resolution arrived at (renaming the file, as it may be conflicting with one of PHP's own) does not work for me. 我发现了这个问题,但是解决方法(重新命名文件,因为可能与PHP自己的文件冲突)对我不起作用。 (Come to think of it, how will a file named facebook.php conflict with internal PHP files?!) Even if I switch to plain
require
, the same warnings are thrown. (想一想,名为facebook.php的文件将与内部PHP文件发生冲突吗?!)即使我切换到普通的
require
,也会引发相同的警告。
Curiously, if I copy the files ( facebook.php
and base_facebook.php
) outside of facebook_sdk
and change the require_once
line accordingly, the require succeeds. 奇怪的是,如果我的文件(复制
facebook.php
和base_facebook.php
)之外facebook_sdk
和改变require_once
相应的路线,需要成功。 Any thoughts? 有什么想法吗?
Your web server needs read access right to facebook_sdk/facebook.php
. 您的Web服务器需要对
facebook_sdk/facebook.php
读取访问权限。 You can do it by chown
ing the directory to the web server user. 你可以做到这一点
chown
荷兰国际集团的目录到Web服务器的用户。 chmod 777
is not a good practice. chmod 777
不是一个好习惯。
Also make sure for each of include path, facebook_sdk/facebook.php
exists. 还要确保每个include路径都存在
facebook_sdk/facebook.php
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.