Fixing Magic Quotes for Joomla 3.x
What is Magic Quotes?
At its most basic level, it is the setting within PHP that allows quotation marks to be allowed or stripped out of a string.
How do I tell if it is enabled/disabled?
A. You are seeing a warning message about it:
B. System info: Within Joomla you can go view your SYSTEM INFORMATION from the backend of your website. To get to that screen:
Go to TOOLS->SYSTEM INFO
Go to SITE->SYSTEM INFORMATION
Click on the tab for PHP INFORMATION.
Do a CTRL+F and search for “magic.” You will see something that looks like:
C. If you don’t have access to Joomla site, use phpinfo.php:
This is a file you upload to your FTP and then view in a browser. Make sure you upload it to the EXACT folder you are trying to test. To make a phpinfo.php file, open “Notepad” or another plain text editor and add this line to it:
Save the file as “phpinfo.php”
After uploading it, go to your web browser and go to that location. For example, if you uploaded it to your /newsite/ folder and your website was example.com, then in your address bar, go to http://www.example.com/newsite/phpinfo.php
How to Fix It
A. Use cPanel php.ini EZ Config: If you have a good hosting company, then you probably have an icon in your cPanel called “php.ini EZConfig.” This is by far the easiest way to solve this problem.
Scroll down and make sure all Magic Quotes options are set to OFF. Then hit SAVE CHANGES:
B. Adjust your php.ini file: In your FTP, find and download your php.ini file from the root folder that your Joomla site is in. If you don’t see one, you can make a new file in Notepad (or other plain text editor) and save as php.ini. Add the following lines:
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
C. Adjust your .htaccess file: If you prefer to make the change to your .htaccess file, or your host does not allow you to modify your php.ini, then add these lines to your .htaccess file.
php_flag magic_quotes_gpc off
A. Check whether your site is pulling the correct php.ini: To check this, go to the SYSTEM INFO->PHP INFORMATION or PHPINFO.PHP webpage mentioned earlier in the post. Look for the line “Loaded Configuration File.” You want this to be the php.ini you modified and uploaded.
B. Force server to pull correct php.ini: You will need to add the following line to your .htaccess file. To get the specific path that is correct for your site, go back to your GLOBAL CONFIGURATION->SYSTEM SETTINGS and find the “Path to Log Folder.” Take everything before the /logs and then add php.ini at the end of it.
SetEnv PHPRC /home/username/public_html/php.ini
C. Some hosting companies require you to call the file php5.ini. Godaddy is guilty of this. If you know of others, please add in the comments.
D. If you are on Godaddy, you will need to restart your server. Login to your hosting management, and go to SYSTEM PROCESSES.
Then click on the icon that says END WEB.
Go back to your website and reload it. It *should* work now.
Having a good hosting company will literally solve 75% of your Joomla problems which is why people in the Joomla forum mention it so much. We use HostGator Hosting for all our websites and never have issues with server settings. If you would like to switch to them, please use our affiliate link.
YellowWebMonkey Web design offers reliable website design, SEO and digital marketing services for Joomla, WordPress and Shopify sites. We strive to be a one-stop shop for all your web needs.