无法在PHP中更改allow

系统教程 行业动态 更新时间:2024-06-14 16:57:17
无法在PHP中更改allow_url_include值(Cannot change allow_url_include value in PHP)

我在运行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 0

I 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_STRICT

Use:

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.

更多推荐

本文发布于:2023-04-12 20:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/da05657fea117355b3b7bd94c9f872a3.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!