【发布时间】:2013-01-06 01:49:49
【问题描述】:
我使用这个 Yubico 认证 PHP 类:https://github.com/Yubico/php-yubico。我用这段代码创建了 php 文件 test.php:
<?php
require_once 'Auth/Yubico.php';
$otp = "ccbbddeertkrctjkkcglfndnlihhnvekchkcctif";
# Generate a new id+key from https://api.yubico.com/get-api-key/
$yubi = new Auth_Yubico('42', 'FOOBAR=');
$auth = $yubi->verify($otp);
if (PEAR::isError($auth)) {
print "<p>Authentication failed: " . $auth->getMessage();
print "<p>Debug output from server: " . $yubi->getLastResponse();
} else {
print "<p>You are authenticated!";
}
?>
并在这个 github 库中执行所有指令。当我打开这个脚本时,我得到:
警告:require_once():open_basedir 限制生效。 文件(/usr/share/php/Auth/Yubico.php)不在允许范围内 路径:(/var/www/hmci/data:.)在 /var/www/hmci/data/www/hmci.ru/php-yubico/test.php 在第 2 行警告: require_once(/usr/share/php/Auth/Yubico.php):无法打开流: 不允许操作 /var/www/hmci/data/www/hmci.ru/php-yubico/test.php 在第 2 行致命 错误:require_once():无法打开所需的“Auth/Yubico.php” (include_path='.:/usr/share/php:/usr/share/pear') 在 /var/www/hmci/data/www/hmci.ru/php-yubico/test.php 在第 2 行
如何解决这个问题?
【问题讨论】:
标签: php require-once open-basedir