为什么我收到 php 错误

发布于 2024-11-17 14:10:39 字数 2146 浏览 2 评论 0原文

我正在开发 Twitter 登录应用程序,

我的 config.php 是:

//My modification of Abraham's Config specifically for calling variables from the Question2Answer DB

////// First establish base directory for app
define('QA_BASE_DIR', dirname(empty($_SERVER['SCRIPT_FILENAME']) ? __FILE__ : $_SERVER['SCRIPT_FILENAME']).'/../../');
$qainc=$_SERVER['DOCUMENT_ROOT'] . '/qa-include';

////// Require the qa-base.php
require $qainc. '/qa-base.php';

////// Require the qa-db, connect to the db, and provide a fail handler
////// As Adam Savage says "Failure is Always an Option"
require $qainc. '/qa-db.php';
$failhandler ='Database Connection Failure';    
$connect=qa_db_connect($failhandler);

//////Get the variables for the Twitter Details
$TW_CALLBACK_URL=qa_opt('TW_CALLBACK_URL');
$TW_CONSUMER_KEY=qa_opt('TW_CONSUMER_KEY');
$TW_CONSUMER_SECRET=qa_opt('TW_CONSUMER_SECRET');
$TW_OAUTH_TOKEN=qa_opt('TW_OAUTH_TOKEN');
$TW_OAUTH_SECRET=qa_opt('TW_OAUTH_SECRET');

//////Define the variables
define('CONSUMER_KEY', "$TW_CONSUMER_KEY");
define('CONSUMER_SECRET', "$TW_CONSUMER_SECRET");
define('OAUTH_CALLBACK', "$TW_CALLBACK_URL");
define('oauth_token',"$TW_OAUTH_TOKEN");
define('oauth_secret',"$TW_OAUTH_SECRET");

但我收到此错误:

Warning: require() [function.require]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/qa-include/qa-base.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a7820858/public_html/qa-plugin/twitter-oauth-login/config.php on line 22


PHP Error Message 

Warning: require(/usr/local/apache/htdocs/qa-include/qa-base.php) [function.require]: failed to open stream: Operation not permitted in /home/a7820858/public_html/qa-plugin/twitter-oauth-login/config.php on line 22

PHP Error Message 

Fatal error: require() [function.require]: Failed opening required '/usr/local/apache/htdocs/qa-include/qa-base.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a7820858/public_html/qa-plugin/twitter-oauth-login/config.php on line 22

我的目录结构包含这些文件夹:

qa-plugin/twitter-oauth-login/some files

I am working on twitter login application

my config.php is:

//My modification of Abraham's Config specifically for calling variables from the Question2Answer DB

////// First establish base directory for app
define('QA_BASE_DIR', dirname(empty($_SERVER['SCRIPT_FILENAME']) ? __FILE__ : $_SERVER['SCRIPT_FILENAME']).'/../../');
$qainc=$_SERVER['DOCUMENT_ROOT'] . '/qa-include';

////// Require the qa-base.php
require $qainc. '/qa-base.php';

////// Require the qa-db, connect to the db, and provide a fail handler
////// As Adam Savage says "Failure is Always an Option"
require $qainc. '/qa-db.php';
$failhandler ='Database Connection Failure';    
$connect=qa_db_connect($failhandler);

//////Get the variables for the Twitter Details
$TW_CALLBACK_URL=qa_opt('TW_CALLBACK_URL');
$TW_CONSUMER_KEY=qa_opt('TW_CONSUMER_KEY');
$TW_CONSUMER_SECRET=qa_opt('TW_CONSUMER_SECRET');
$TW_OAUTH_TOKEN=qa_opt('TW_OAUTH_TOKEN');
$TW_OAUTH_SECRET=qa_opt('TW_OAUTH_SECRET');

//////Define the variables
define('CONSUMER_KEY', "$TW_CONSUMER_KEY");
define('CONSUMER_SECRET', "$TW_CONSUMER_SECRET");
define('OAUTH_CALLBACK', "$TW_CALLBACK_URL");
define('oauth_token',"$TW_OAUTH_TOKEN");
define('oauth_secret',"$TW_OAUTH_SECRET");

But I am getting this error:

Warning: require() [function.require]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/qa-include/qa-base.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a7820858/public_html/qa-plugin/twitter-oauth-login/config.php on line 22


PHP Error Message 

Warning: require(/usr/local/apache/htdocs/qa-include/qa-base.php) [function.require]: failed to open stream: Operation not permitted in /home/a7820858/public_html/qa-plugin/twitter-oauth-login/config.php on line 22

PHP Error Message 

Fatal error: require() [function.require]: Failed opening required '/usr/local/apache/htdocs/qa-include/qa-base.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a7820858/public_html/qa-plugin/twitter-oauth-login/config.php on line 22

My directory structure contains these folders:

qa-plugin/twitter-oauth-login/some files

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

瞄了个咪的 2024-11-24 14:10:39

由于您的 open_basedir,您不允许在根目录之外包含任何 php 文件。更改此设置,或移动 QA_BASE_DIR 当前所在的位置。

Because of your open_basedir, you are not allowed to include any php files outside your root. Change this setting, or move where your QA_BASE_DIR is currently at.

贪恋 2024-11-24 14:10:39

您尝试包含的文件不在 open_basedir 中指定的目录中。

将所有内容移至 /home/,或将 /usr/local/apache/htdocs/ 添加到 open_basedir

You're trying to include file that does not reside in directories specified in open_basedir.

Either move everything to /home/, or add /usr/local/apache/htdocs/ to open_basedir.

素年丶 2024-11-24 14:10:39

open_basedir 限制限制 PHP 访问以下文件:一棵树。您尝试包含的文件可能位于该树之外?

The open_basedir restriction confines PHP to accessing files within a tree. The files you're trying to include are perhaps out outside that tree?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文