我在运行 Ubuntu 14.04
的 PC 上使用 PHP 5.5.9
和 Apache 2.4.7
。我试图包含一个位于另一个 Web 服务器中的 PHP 脚本,只是为了某些测试目的。但我似乎无法打开 allow_url_include
。我试过这个:
<?php
echo(ini_get("allow_url_include") . "<br />");
ini_set("allow_url_include", "On");
echo(ini_get("allow_url_include"));
?>
它给了我这个输出:
0
0
我什至通过编辑实际的 /etc/php5/apache2/php.ini
文件并设置 allow_url_include = Off
来尝试这个,但仍然是一样的。
我该怎么做?
最佳答案
YES! It worked :D Right, that one line of warning caused it! I changed it to error_reporting = E_ALL in the original php.ini file and now I can change allow_url_fopen to 1. Post it as an answer and I will mark it as accepted. Thanks everyone. – lonekingc4
我看到了您的 pastebin 文件,其中包含您使用的代码:
error_reporting(E_ALL)
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
使用:
error_reporting = E_ALL
而不是 error_reporting(E_ALL)
- 因此,警告
警告:语法错误,意外的'('...
error_reporting(E_ALL)
用于将其放入 .php 文件中。
即:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// rest of code
- 这样做,重新启动 Apache,您就可以开始了。
旁注: Error reporting应该只在暂存阶段完成,绝不能在生产阶段完成。
关于php - 无法更改 PHP 中的 allow_url_include 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27640483/