2
votes

I want to turn off PHP's magic quotes. I don't have access to php.ini.

Without this I am not able to install joomla 3.x.x into server.

2

2 Answers

3
votes

For MAMP

Steps:

  1. Go to 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".
  3. Restart MAMP's servers.

For most mainstream hosting companies running a CGI-Webinterface

Steps:

Create a php.ini or php5.ini file with the following:

magic_quotes_gpc = Off

Put it in your Joomla 3 root. Then change the htaccess.txt in your Joomla 3 root to .htaccess. Add the following lines to the .htaccess file (at the top), don't forget to change php.ini to php5.ini when applicable :

<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. The "/home/myusername/public_html/yourJ3folder" can be found via the Global Configuration:

In Joomla backend > System > System Information > [Directory Permissions], the folder is usually the same as the log directory (but without /logs at the end).


.htaccess for some hosts

For some hosts, add the following to the .htaccess file in the root of your site (for example /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! 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

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)

Works for PHP 5.3 and higher

create a .user.ini file at your Joomla! 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

0
votes

From PHP documentation - http://php.net/manual/en/security.magicquotes.disabling.php

The magic_quotes_gpc directive may only be disabled at the system level, and not at runtime. In otherwords, use of ini_set() is not an option.

BUT

If access to the server configuration is unavailable, use of .htaccess is also an option. For example:

php_flag magic_quotes_gpc Off