php 在 .htaccess 文件中将安全模式设置为 OFF 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9538005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 07:02:54  来源:igfitidea点击:

Setting safe mode to OFF in .htaccess file does not work

php.htaccesssafe-modephp-safe-mode

提问by eric.itzhak

I'm on a server with safe mode on. Now the server allows .htaccess files. I have one in my public_html folder with settings of Wordpress. Now in a sub-domain i want to insert an .htaccessfile that dsiables safe mode.

我在打开安全模式的服务器上。现在服务器允许 .htaccess 文件。我的 public_html 文件夹中有一个包含 Wordpress 设置的文件夹。现在在一个子域中,我想插入一个.htaccess支持安全模式的文件。

i Tried theese:

我试过这些:

php_value safe_mode 0
php_flag safe_mode 0
php_value safe_mode off
php_flag safe_mode off

but none worked.

但没有一个工作。

Anyone knows how can i do that? I Can not ask the server owner to disable safe mode, and basicly can't ask him anything.

有谁知道我该怎么做?我不能要求服务器所有者禁用安全模式,基本上不能问他任何事情。

采纳答案by Brian

It sounds like he doesn't allow you to override safe mode. Which makes sense because what would be the point in running a shared server in safe mode if anyone could disable it as they saw fit. You're probably going to need to relocate to a server without safe mode as the only options for changing that value are not going to work for you. Safe mode is already deprecated and is not meant to be used. The "safe" way for a server owner to handle security is through the OS and setting up correct account permissions.

听起来他不允许您覆盖安全模式。这是有道理的,因为如果任何人都可以按照他们认为合适的方式禁用它,那么在安全模式下运行共享服务器的意义何在。您可能需要重新定位到没有安全模式的服务器,因为更改该值的唯一选项对您不起作用。安全模式已被弃用,不应使用。服务器所有者处理安全性的“安全”方式是通过操作系统并设置正确的帐户权限。

回答by Arjan

It is not possible to change the value of safe_modein .htaccess. The configuration setting can only be set in php.inior httpd.conf, as is explained in the manpages

无法更改safe_modein的值.htaccess。配置设置只能在php.ini或 中设置httpd.conf,如联机帮助页中所述

It also wouldn't be safe if it could be set in .htaccess. And it's removed in PHP 5.4, so that could be an argument to tell your hoster to disable it for you.

如果它可以设置在.htaccess. 它在 PHP 5.4 中被删除,所以这可能是一个参数,告诉您的主机为您禁用它。

回答by alucic

I have managed to disable safe_mode by following instructions from Marco Demaio in last answer in this question How to turn off php safe_mode off for a particular directory in a shared hosting environment?

我已经按照 Marco Demaio 在这个问题的最后一个回答中的说明设法禁用了 safe_mode如何关闭共享托管环境中特定目录的 php safe_mode?

I hope it works for you too!

我希望它也适用于你!