我在运行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尝试这个,但是,它仍然是相同的。
我该怎么做?
I am using PHP 5.5.9 with Apache 2.4.7 on my PC running Ubuntu 14.04. I am trying to include a PHP script located in another web server just for some testing purposes. But I cannot seem to be able to turn allow_url_include on. I tried this:
<?php echo(ini_get("allow_url_include") . "<br />"); ini_set("allow_url_include", "On"); echo(ini_get("allow_url_include")); ?>And it gives me this output:
0 0I even tried this by editing the actual /etc/php5/apache2/php.ini file and set allow_url_include = Off, but still, it's the same.
How do I do it?
最满意答案
是! 它起作用了:D对,那一行警告引起了它! 我在原始的php.ini文件中将其更改为error_reporting = E_ALL,现在我可以将allow_url_fopen更改为1.将其作为答案发布,我将其标记为已接受。 感谢大家。 - 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) - 因此,警告
Warning: syntax error, unexpected '('...
将它放在.php文件中时使用error_reporting(E_ALL) 。
即:
<?php error_reporting(E_ALL); ini_set('display_errors', 1); // rest of code 这样做,重启Apache,你应该好好去。旁注: 错误报告应该只在暂存中完成,而不是生产。
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
I saw your pastebin file with the codes you were using:
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_STRICTUse:
error_reporting = E_ALL and not error_reporting(E_ALL) - thus, the warning
Warning: syntax error, unexpected '('...
error_reporting(E_ALL) is used when you put it in a .php file.
I.e.:
<?php error_reporting(E_ALL); ini_set('display_errors', 1); // rest of code Do that, restart Apache and you should be good to go.Sidenote: Error reporting should only be done in staging, and never production.
更多推荐
发布评论