allow_url_fopen选项局部变量

问题描述:

我在phpMyAdmin加入验证码通过将两个变量allow_url_fopen选项局部变量

$ CFG [ 'CaptchaLoginPublicKey'] = '站点密钥';

$ cfg ['CaptchaLoginPrivateKey'] ='密钥';

但我在下面出错。

Warning in ./libraries/plugins/auth/recaptcha/ReCaptcha/RequestMethod/Post.php#68 
file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 

Backtrace 

./libraries/plugins/auth/recaptcha/ReCaptcha/RequestMethod/Post.php#68: file_get_contents(
string 'https://www.google.com/recaptcha/api/siteverify', 
boolean false, 
resource, 
) 
./libraries/plugins/auth/recaptcha/ReCaptcha/ReCaptcha.php#94: ReCaptcha\RequestMethod\Post->submit(object) 
./libraries/plugins/auth/AuthenticationCookie.class.php#366: ReCaptcha\ReCaptcha->verify(
string '03AHJ_VuvVnV4jlI2mNDNogB6eajU4jE--F7ve8zMdP0Xf636gaBeNE_dK9-', 
string '10.0.5.1', 
) 
./libraries/common.inc.php#896: AuthenticationCookie->authCheck() 
./index.php#12: require_once(./libraries/common.inc.php) 

Warning in ./libraries/plugins/auth/recaptcha/ReCaptcha/RequestMethod/Post.php#68 
file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: no suitable wrapper could be found 

Backtrace 

./libraries/plugins/auth/recaptcha/ReCaptcha/RequestMethod/Post.php#68: file_get_contents(
string 'https://www.google.com/recaptcha/api/siteverify', 
boolean false, 
resource, 
) 
./libraries/plugins/auth/recaptcha/ReCaptcha/ReCaptcha.php#94: ReCaptcha\RequestMethod\Post->submit(object) 
./libraries/plugins/auth/AuthenticationCookie.class.php#366: ReCaptcha\ReCaptcha->verify(
string '03AHJ_VuvVnV4jlI2mNDNogB6eajU4jE--F7ve', 
string '10.0.5.1', 
) 
./libraries/common.inc.php#896: AuthenticationCookie->authCheck() 
./index.php#12: require_once(./libraries/common.inc.php) 

所以我想打开phpMyAdmin的allow_url_fopen。我改变/etc/php5/apache2/php.ini和/etc/php5/fpm/php.ini到

了allow_url_fopen =开

allow_url_include =开

根的phpinfo节目我正确的设置。

Directive   Local Value Master Value 
allow_url_fopen  On    On 
allow_url_include On    On 

但是,在phpMyAdmin文件夹中。

Directive   Local Value Master Value 
allow_url_fopen  Off   On 
allow_url_include On    On 

所以我试了PHP在phpMyAdmin文件夹中测试。

ini_set(“allow_url_fopen”,true);如果(ini_get(“allow_url_fopen”)== true){echo“allow_url_fopen is ON”;}回到顶端这篇文章中的信息适用于: }

else {echo“allow_url_fopen is OFF”;} }

print ini_get(“allow_url_fopen”);

print ini_get(“allow_url_include”);

exit;

allow_url_fopen is OFF01 

我也试图在phpMyAdmin文件夹添加的.htaccess。

php_value allow_url_fopen选项在

为什么当地的价值不能在phpMyAdmin文件夹是否会改变?

我的服务器是Debian8.2,PHP5.6.17,phpMyAdmin4.5,MySQL5.7,它位于防火墙之后。

我知道将全局allow_url_fopen设置为On是危险的。我怎样才能只将它设置为phpMyAdmin文件夹?

+0

你不能改变这个标志,由于安全问题上的动态。你需要检查你的php.ini配置(在web服务器配置中都是php.ini文件和php标志) –

+0

那么你的意思是更改/etc/php5/apache2/php5.ini中的配置?我改变了和根文件夹的作品,但phpmyadmin文件夹不起作用。 – hatted

+0

虚拟主机文件如何?它是否对PHP标志有任何改变? –

感谢团。你是对的。我修改了虚拟主机,它现在可以工作。

vim/etc/apache2/conf-available/phpmyadmin。CONF

php_admin_flag于allow_url_fopen在

php_admin_flag allow_url_include在

+0

不客气:)。 –