简体   繁体   English

如何关闭Joomla 3的魔术引号gpc?

[英]How to turn off magic quotes gpc for Joomla 3?

I want to turn off PHP's magic quotes. 我想关闭PHP的魔术引号。 I don't have access to php.ini. 我无权访问php.ini。

Without this I am not able to install joomla 3.xx into server. 没有这个,我将无法将joomla 3.xx安装到服务器中。

For MAMP 对于MAMP

Steps: 脚步:

  1. Go to MAMP application >> Preferences (button) >> PHP (tab) >> Choose 5.3.1 or greater >> choose OK . 转到MAMP application >> Preferences (button) >> PHP (tab) >> Choose 5.3.1 or greater >> choose OK
  2. Go to the MAMP folder >> bin >> php >> php5.3.26 >> conf >> edit php.ini >> add "magic_quotes_gpc = Off" a few lines above "magic_quotes_sybase = Off" . 转到MAMP folder >> bin >> php >> php5.3.26 >> conf >> edit php.ini >> add "magic_quotes_gpc = Off"上方MAMP folder >> bin >> php >> php5.3.26 >> conf >> edit php.ini >> add "magic_quotes_gpc = Off"几行"magic_quotes_sybase = Off"
  3. Restart MAMP's servers. 重新启动MAMP的服务器。

For most mainstream hosting companies running a CGI-Webinterface 对于大多数运行CGI-Webinterface的主流托管公司

Steps: 脚步:

Create a php.ini or php5.ini file with the following: 使用以下php5.ini创建一个php.iniphp5.ini文件:

magic_quotes_gpc = Off

Put it in your Joomla 3 root. 将其放在您的Joomla 3根目录中。 Then change the htaccess.txt in your Joomla 3 root to .htaccess . 然后改变htaccess.txt在您的Joomla 3根.htaccess Add the following lines to the .htaccess file (at the top), don't forget to change php.ini to php5.ini when applicable : php5.ini添加到.htaccess文件中(在顶部),请不要忘记在适用时将php.ini更改为php5.ini

<IfModule mod_suphp.c>
  suPHP_ConfigPath /home/myusername/public_html/yourJ3folder
  <Files php.ini>
    order allow,deny
    deny from all
  </Files>
</IfModule>

Change " myusername " and " yourJ3folder " to your respective folders. 将“ myusername ”和“ yourJ3folder ”更改为各自的文件夹。 The " /home/myusername/public_html/yourJ3folder " can be found via the Global Configuration: 可以通过全局配置找到“ /home/myusername/public_html/yourJ3folder ”:

In Joomla backend > System > System Information > [Directory Permissions] , the folder is usually the same as the log directory (but without /logs at the end). Joomla backend > System > System Information > [Directory Permissions] ,该文件夹通常与日志目录相同(但末尾没有/ logs)。


.htaccess for some hosts .htaccess对于某些主机

For some hosts, add the following to the .htaccess file in the root of your site (for example /home/myusername/public_html/.htaccess ) 对于某些主机,将以下内容添加到网站根目录中的.htaccess文件中(例如/home/myusername/public_html/.htaccess

php_flag magic_quotes_gpc off

Yet Another Solution For Shared Hosts 共享主机的另一种解决方案

create a php.ini file at your Joomla! 在您的Joomla上创建一个php.ini文件! root. 根。 Add this content to the file and save 将此内容添加到文件并保存

magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off

Edit your .htaccess file and add this line at the top and save the file 编辑您的.htaccess文件,并在顶部添加此行并保存文件

SetEnv PHPRC /home/youruser/public_html/php.ini

Test if the error message goes away 测试错误消息是否消失

source : How to turn off magic quotes on shared hosting? 来源: 如何在共享主机上关闭魔术引号?


Another solution (for the hosts where PHP is running as FCGI module) 另一个解决方案(适用于PHP作为FCGI模块运行的主机)

Works for PHP 5.3 and higher 适用于PHP 5.3及更高版本

create a .user.ini file at your Joomla! 在您的Joomla上创建一个.user.ini文件! root. 根。 Add this content to the file and save 将此内容添加到文件并保存

magic_quotes_gpc = Off

SRC - https://docs.joomla.org/How_to_turn_off_magic_quotes_gpc_for_Joomla_3 SRC-https://docs.joomla.org/How_to_turn_off_magic_quotes_gpc_for_Joomla_3

From PHP documentation - http://php.net/manual/en/security.magicquotes.disabling.php 从PHP文档 -http://php.net/manual/zh/security.magicquotes.disabling.php

The magic_quotes_gpc directive may only be disabled at the system level, and not at runtime. magic_quotes_gpc指令只能在系统级别禁用,而不能在运行时禁用。 In otherwords, use of ini_set() is not an option. 换句话说,不能使用ini_set()。

BUT

If access to the server configuration is unavailable, use of .htaccess is also an option. 如果无法访问服务器配置,则也可以选择使用.htaccess。 For example: 例如:

php_flag magic_quotes_gpc Off

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM