Tuesday, October 22, 2013

Solution Tutorial: How To Turn Off magic quotes in Joomla 3


Description of the problem

The problem is that when you upload images and insert them into Joomla 3 articles (or pages), the code  \" is added to the HTML code of the images. Actually  \" is added every time you insert a HTML code containing the character “, which almost all HTML contains.

Reason for the problem

The reason why this happens is that the PHP setting magic quotes is turned On. It is a setting for PHP, that was originally developed to prevent beginners of entering bad code. So some characters (“, ‘, \ and NULL) was replaced with a \. However this setting caused more problems for users of PHP, than it solved problems. So it is removed from the future PHP version 6.
So since there is no good reason to keep magic quotes turned on, you should turn it off.

There are two way to turn off magic quotes (Mainly in share hosting) :

1.  Using php.ini file

One way to solve the problem is to add  the following line to your PHP.INI file of your root folder and your administrator folder :

magic_quotes_gpc = Off

If you don’t already have a PHP.INI file you can create it. Unfortunately, not all hosts allow to create your own PHP.INI file and if you try, it wont work. In this case you should solve the problems in a .HTACCESS file.
When you create a local php.ini as originally indicated and added it to the joomla_root/ directory you must also add a copy to the joomla_root/administrator/ directory too, that way both the site index.php and the administrator index.php are working from the same song sheet!


2.  Using  the .HTACCESS file

HTACCESS file is placed in your root folder. If there is no .HTACCESS file, you can either create a new one or rename the file HTACCESS.txt to .HTACCESS (Not .HTACCESS.txt). Then you can add the following line:

php_flag magic_quotes_gpc 0

This should work. Check if Magic quotes is turned off, by going to PHP settings in System -> System informations -> PHP settings in backend of your Joomla installation. At the list, Magic quotes should now be turned off.

More Important Link
http://docs.joomla.org/How_to_turn_off_magic_quotes_gpc_for_Joomla_3
http://forum.joomla.org/viewtopic.php?t=94451
http://webmaster-land.com/solve-problems-with-magic-quotes-in-joomla-3/


Total Pageviews