Many people are finding that Joomla 3 has a problem with installation and Magic Quotes.  If your hosting company has magic quotes turned on in their PHP settings, you may not be able to finish the installation of a Joomla 3+ site or you may get a warning appearing with your Joomla admin login or admin pages.

Magic Quotes is a setting in PHP that is intended to automatically escape specific characters, such as apostrophes, with a backslash. It was intended for SQL commands, but unfortunately can effect many other areas, including when you are entering content with a text editor. 

Some Joomla developers get through the setup of their Joomla site, but then find that Joomla is adding slashes in front of all apostrophes in their content. This is also a Magic Quotes issue. See the joom3 article on How to stop putting slashes in front of apostrophes.

You may need to try one or more of the following steps to address this problem. A couple of different steps may be necessary if one alone doesn't clear up the issue. If you are working with a live site that is giving you the warning about magic quotes, check the front and back end of your site after each step. Some steps will cause your site to break, you want to be sure that you know which step caused this issue.

php.ini and PHP settings

If you want to see what PHP settings your hosting environment has you can upload a phpinfo.php file to your root directory and see a listing of all the PHP settings for your site. Open up a text editor to a blank document and type in these lines:

<?php phpinfo(); ?>

Save the document as phpinfo.php. Upload this file to the root of your site. Type in your url (domain name) followed by a forward slash followed by phpinfo.php. For example:

A web page should appear with a chart of all the current php settings for your hosting environment. Hold the CNTL + f and do a search for magic. You should see three lines like this:


If any of these three lines are set to ON for the local values, you may have trouble with installing or using Joomla 3.

There are some workarounds that you might try. Be sure to keep track of what steps you have taken, you may need to undo a step if it causes issues or you may need to repeat these steps when you upgrade your Joomla installation, set up a new domain on the same host or move your site to a different hosting environment.

Contact your hosting company

See if this setting can be turned off for your site. Many hosting companies don't like dealing with specific questions about CMS systems like Joomla, WordPress or Drupal. So you may not have much luck with this route.

Some hosting environments do not utilize local php.ini files.

Create a php.ini file

You can create a blank document in a text editor and add these lines. 

magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
session.save_path = "/tmp"

Save the document as php.ini or php5.ini. Upload this file to the root directory, the administrator directory and the installation directory.

Tell your system to look for this php.ini file in the .htaccess file

It may be necessary to edit the .htaccess file to tell the system to look for the initial php.ini file. A new Joomla installation will have a file called htaccess.txt in the root directory. Rename this file to .htaccess, or open up the existing .htaccess file on live sites, and place this following line at the very top. The example shows "directoryname", replace this with the correct path to the php.ini file for your individual file structure on your host.

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

Other steps for .htaccess

Some Joomla users find they can emulate the PHP settings for Magic Quotes by adding lines to their .htaccess file. Be very cautious with these steps, as they have been known to break the site. If they do break the site, first verify that the path structure is correct  or simply remove the lines that you just added.

php_flag magic_quotes_gpc off

and or the following lines near the top (replace the highlighted information with the correct path for your installation).

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

Create a .user.ini file

In the root of your Joomla installation in the hosting files. Create a document called .user.ini. Add the following lines to this document:

magic_quotes_gpc = Off

Remove the lines from the setup.php file in the installation directory

The installation directory only exists on Joomla installations that have not gone through the initial configuration. If you just want to get your site up and running, take this step. Be warned that you may have issues with Magic Quotes later on, as this is just a stopgap measure.

Using FTP or some sort of file manager, download this file from your Joomla installation:


find the following lines: 

// Check for magic quotes gpc.
$option = new stdClass;
$option->label = JText::_('INSTL_MAGIC_QUOTES_GPC');
$option->state = (ini_get('magic_quotes_gpc') == false);
$option->notice = null;
$options[] = $option;

put double slashes in front of each of the lines - this essentially comments out the lines so that Joomla will not run the text for Magic Quotes during installation.

// Check for magic quotes gpc.
//$option = new stdClass;
//$option->label = JText::_('INSTL_MAGIC_QUOTES_GPC');
//$option->state = (ini_get('magic_quotes_gpc') == false);
//$option->notice = null;
//$options[] = $option;

Go back to your hosting directories and make a copy of the current setup.php and rename it something like setup-orig.php.

Upload your modified setup.php file to the installation/models directory. Go back to your Joomla installation and see if you can now finish the installation.