Magic Quotes GPC Off ?
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
- duanemitchell
- Joomla! Enthusiast
- Posts: 100
- Joined: Wed Jan 03, 2007 3:16 am
- Location: Boston, MA USA
- Contact:
Magic Quotes GPC Off ?
Can't install without turning magic quotes off in 3.0. I've searched around for a solution and tried a couple without success.
I created a php.ini file in the public_html with the line "magic_quotes_gpc=off", that didn't work.
Gonna open a ticket with Namecheap and see what they say.
I'd be happy to hear any suggestions.
I created a php.ini file in the public_html with the line "magic_quotes_gpc=off", that didn't work.
Gonna open a ticket with Namecheap and see what they say.
I'd be happy to hear any suggestions.
Last edited by humvee on Wed Oct 03, 2012 11:08 am, edited 1 time in total.
Reason: Marked as resolved as per OP
Reason: Marked as resolved as per OP
-
- Joomla! Apprentice
- Posts: 8
- Joined: Mon Oct 01, 2012 10:07 am
- Location: Qld Australia
Re: Magic Quotes GPC Off ?
You my friend might just be in luck , since I just spent 4 hours getting this fixed myself.
I had the Magic Quotes GPC ON and when I fixed THAT problem, I was getting install permission problems.
This was my fix, hope it helps you .
Create php.ini file with the following lines.
magic_quotes_gpc = Off
session.save_path = "/tmp"
Copy to the Installation subfolder of your site.
Let me know if it fixes your problem.
I had the Magic Quotes GPC ON and when I fixed THAT problem, I was getting install permission problems.
This was my fix, hope it helps you .
Create php.ini file with the following lines.
magic_quotes_gpc = Off
session.save_path = "/tmp"
Copy to the Installation subfolder of your site.
Let me know if it fixes your problem.
- duanemitchell
- Joomla! Enthusiast
- Posts: 100
- Joined: Wed Jan 03, 2007 3:16 am
- Location: Boston, MA USA
- Contact:
Re: Magic Quotes GPC Off ?
Nice trick!!! That worked perfectly! Thanks so much!! It got me through the installation. I don't know if they are really turned off or not though? I'll check the server settings.
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sun Sep 30, 2012 9:16 pm
Re: Magic Quotes GPC Off ?
Didn't work for me...
anything else I could do?
anything else I could do?
- duanemitchell
- Joomla! Enthusiast
- Posts: 100
- Joined: Wed Jan 03, 2007 3:16 am
- Location: Boston, MA USA
- Contact:
Re: Magic Quotes GPC Off ?
The only thing I can think of to do is open a ticket with your host and have them do it for you.
AFAIK, the only way to do this is to modify the php configuration through the use of a php.ini file. Some hosts give you access to this, some don't. Where you don't have access you have to create the file as described above and put it into the "Installation" folder.
I tried creating one at the top level of my public_html and that didn't work. It should have though it seems to me. I opened a ticket with Namecheap and they told me that is what to do but I had already used the above solution. I'm wondering if there is a cache issue of some sort?
AFAIK, the only way to do this is to modify the php configuration through the use of a php.ini file. Some hosts give you access to this, some don't. Where you don't have access you have to create the file as described above and put it into the "Installation" folder.
I tried creating one at the top level of my public_html and that didn't work. It should have though it seems to me. I opened a ticket with Namecheap and they told me that is what to do but I had already used the above solution. I'm wondering if there is a cache issue of some sort?
- alikon
- Joomla! Champion
- Posts: 5941
- Joined: Fri Aug 19, 2005 10:46 am
- Location: Roma
- Contact:
- duanemitchell
- Joomla! Enthusiast
- Posts: 100
- Joined: Wed Jan 03, 2007 3:16 am
- Location: Boston, MA USA
- Contact:
Re: Magic Quotes GPC Off ?
Interesting. I did not try this
Discussion on the subject of turning magic quotes off does not seem to settle on one solution. It seems that the way php is config'd on the host server and what one can do to change that varies widely. It seems the trick is to find a thread that works for you.
What's new with the 3.0 install is that the first thing it does is check your settings and if magic quotes is on then it stops right there until it's fixed.
in the .htaccess. I didn't include the "php_flag" part.php_flag magic_quotes_gpc Off
Discussion on the subject of turning magic quotes off does not seem to settle on one solution. It seems that the way php is config'd on the host server and what one can do to change that varies widely. It seems the trick is to find a thread that works for you.
What's new with the 3.0 install is that the first thing it does is check your settings and if magic quotes is on then it stops right there until it's fixed.
- duanemitchell
- Joomla! Enthusiast
- Posts: 100
- Joined: Wed Jan 03, 2007 3:16 am
- Location: Boston, MA USA
- Contact:
Re: Magic Quotes GPC Off ?
This line in the .htaccess file causes a 500 Internal Server Error.php_flag magic_quotes_gpc Off
- duanemitchell
- Joomla! Enthusiast
- Posts: 100
- Joined: Wed Jan 03, 2007 3:16 am
- Location: Boston, MA USA
- Contact:
Re: Magic Quotes GPC Off ?
According to System->PHP Settings Magic Quotes is still on. Apparently the trick I used just got me through the installation.
- duanemitchell
- Joomla! Enthusiast
- Posts: 100
- Joined: Wed Jan 03, 2007 3:16 am
- Location: Boston, MA USA
- Contact:
Re: Magic Quotes GPC Off ?
I'm having issues with image paths getting escaped when they shouldn't as in this thread I posted:
http://forum.joomla.org/viewtopic.php?f ... 4#p2909684
I have a MAMP install of Joomla 3.0 where magic quotes is off and I don't have this problem.
http://forum.joomla.org/viewtopic.php?f ... 4#p2909684
I have a MAMP install of Joomla 3.0 where magic quotes is off and I don't have this problem.
-
- Joomla! Apprentice
- Posts: 8
- Joined: Mon Oct 01, 2012 10:07 am
- Location: Qld Australia
Re: Magic Quotes GPC Off ?
You may have to get your host to set the Magic Quotes option to OFF
Alternatively try placing a php.ini file in each of your sub directories and see if that can fix your issue.
Not sure it will work, but might be worth a try in the short term.
Alternatively try placing a php.ini file in each of your sub directories and see if that can fix your issue.
Not sure it will work, but might be worth a try in the short term.
- duanemitchell
- Joomla! Enthusiast
- Posts: 100
- Joined: Wed Jan 03, 2007 3:16 am
- Location: Boston, MA USA
- Contact:
Re: Magic Quotes GPC Off ?
I got a solution with the help of support at Namecheap. I added this line to my .htaccess:
where username is my cPanel login username.
This was AFTER I used the cPanel tool "Tweak php.ini". That created a full featured php.ini file at the top level of public_html. That had magic quotes on, I set them to off. Then the above .htaccess addition worked to apply that php.ini config to the entire directory.
So I guess, for me on Namecheap as a host, my Joomla 3.0 install procedure would be to create the php.ini with magic_quote_gpc off and then add the above line to .htaccess.
If that doesn't work then I'll use the trick mentioned above of adding the 2 line php.ini to the installation folder, run the installation, then do the above 2 steps.
Code: Select all
suPHP_ConfigPath /home/username/public_html
This was AFTER I used the cPanel tool "Tweak php.ini". That created a full featured php.ini file at the top level of public_html. That had magic quotes on, I set them to off. Then the above .htaccess addition worked to apply that php.ini config to the entire directory.
So I guess, for me on Namecheap as a host, my Joomla 3.0 install procedure would be to create the php.ini with magic_quote_gpc off and then add the above line to .htaccess.
If that doesn't work then I'll use the trick mentioned above of adding the 2 line php.ini to the installation folder, run the installation, then do the above 2 steps.
- humvee
- Joomla! Master
- Posts: 14704
- Joined: Wed Aug 17, 2005 10:27 pm
- Location: Kent, England
Re: Magic Quotes GPC Off ?
[Mod note: Glad you managed to resolve it for yourself. Thank you for providing your solution to this issue for others to see.
Marked Resolved]
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!
Marked Resolved]
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!
-
- Joomla! Apprentice
- Posts: 21
- Joined: Fri Dec 03, 2010 7:38 pm
- Location: Edo. México | México
Re: Magic Quotes GPC Off ?
Yes... It works nice to turn off magic Quotes... in my case there is a Installatron Aplication Installer that install the last version of several programs.
But the magic Quotes where On, and then I had the version install but with the problems. I did put the php.ini in Administrator folder. Work fine.
Thanks a lot for your tips….!!!
But the magic Quotes where On, and then I had the version install but with the problems. I did put the php.ini in Administrator folder. Work fine.
Thanks a lot for your tips….!!!
-
- Joomla! Apprentice
- Posts: 21
- Joined: Fri Dec 03, 2010 7:38 pm
- Location: Edo. México | México
Re: Magic Quotes GPC Off ?
Thanks a lot..... I just want to know and get familiarize with the new release of Joomla 3.0. But I keep working with my Joomla 2.5.7 version!!! Thanks you for your suggestion!!!
-
- Joomla! Apprentice
- Posts: 8
- Joined: Mon Oct 01, 2012 10:07 am
- Location: Qld Australia
Re: Magic Quotes GPC Off ?
An addendum to my original solution to getting Joomla 3.0 to install.
The following is a multiple step solution to
1. Install
2. Turn Magic Quotes off
Step 1.
Copy your Joomla 3.0 folders to your webhost
Create a php.ini file with the following lines:
magic_quotes_gpc = Off
session.save_path = "/tmp"
Copy the php.ini file to your /installation subfolder on your webhost.
(You may or may not need the session.save_path line and you might need to edit it for the specific location of the /tmp folder on your webhost)
Now you should be able to go to your browser , open your website and have Joomla think magic quotes is off. (It isn't really, but this will let you install at least.)
Proceed with your install.
Step2.
Go to the root folder of your website and create a php.ini file
Add the following lines:
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
Next we need to edit/create a .htaccess file in the root directory
it should have the following line:
SetEnv PHPRC /path /to/php.ini
The path will vary depending on your webhost
For example on my own site it is set as follows:
"SetEnv PHPRC /home/username/public_html/php.ini" where the username is my cpanel username.
Now for the usual problems.
If you create a php.ini file or a .htaccess file in some editors, be aware they may add an extension to the filename.
Make sure php.ini ISN'T really php.ini.txt for example.
And don't forget the "." in front of the .htaccess
I hope this guide helps someone struggling to get Joomla working.
Hang in there, it is well worth the effort.
The following is a multiple step solution to
1. Install
2. Turn Magic Quotes off
Step 1.
Copy your Joomla 3.0 folders to your webhost
Create a php.ini file with the following lines:
magic_quotes_gpc = Off
session.save_path = "/tmp"
Copy the php.ini file to your /installation subfolder on your webhost.
(You may or may not need the session.save_path line and you might need to edit it for the specific location of the /tmp folder on your webhost)
Now you should be able to go to your browser , open your website and have Joomla think magic quotes is off. (It isn't really, but this will let you install at least.)
Proceed with your install.
Step2.
Go to the root folder of your website and create a php.ini file
Add the following lines:
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
Next we need to edit/create a .htaccess file in the root directory
it should have the following line:
SetEnv PHPRC /path /to/php.ini
The path will vary depending on your webhost
For example on my own site it is set as follows:
"SetEnv PHPRC /home/username/public_html/php.ini" where the username is my cpanel username.
Now for the usual problems.
If you create a php.ini file or a .htaccess file in some editors, be aware they may add an extension to the filename.
Make sure php.ini ISN'T really php.ini.txt for example.
And don't forget the "." in front of the .htaccess
I hope this guide helps someone struggling to get Joomla working.
Hang in there, it is well worth the effort.
- humvee
- Joomla! Master
- Posts: 14704
- Joined: Wed Aug 17, 2005 10:27 pm
- Location: Kent, England
Re: Magic Quotes GPC Off ?
@silicon_chip Thanks for posting back with your latest solution. Just bear in mind that not everyone has access or permission to create local php.ini files on their hosting providers. Just make sure as above that the php.ini file is placed in both joomla_root/ and joomla_root/administrator/
The other solution is to find a host that configures their servers properly in the first place.
The other solution is to find a host that configures their servers properly in the first place.
-
- Joomla! Apprentice
- Posts: 10
- Joined: Thu Jun 09, 2011 1:55 am
Re: Magic Quotes GPC Off ?
Wow, thank you Silicon Chip... This works!!!
All I was missing was this...
All I was missing was this...
Next we need to edit/create a .htaccess file in the root directory
it should have the following line:
SetEnv PHPRC /path /to/php.ini
The path will vary depending on your webhost
For example on my own site it is set as follows:
"SetEnv PHPRC /home/username/public_html/php.ini" where the username is my cpanel username.
-
- Joomla! Fledgling
- Posts: 1
- Joined: Mon Oct 08, 2012 8:26 am
Re: Magic Quotes GPC Off ?
looking all over for this solution. Thanks !
-
- Joomla! Apprentice
- Posts: 36
- Joined: Thu Aug 14, 2008 11:54 am
- Location: Gdańsk, Poland
- Contact:
Re: Magic Quotes GPC Off ?
Php.ini will work if the host allows custom php.ini, in most cases hosts DON'T allow this.
I think it's time to erase this idiotic thing from the installation rules.
I think it's time to erase this idiotic thing from the installation rules.
http://uk.webastyczny.pl - design, corporate identity, IT projects
-
- Joomla! Exemplar
- Posts: 8808
- Joined: Sat Oct 01, 2011 7:06 pm
Re: Magic Quotes GPC Off ?
Don't think removing proper error handling is the solutions to erroneous configurations. Do you really want your site users to tell you your infrastructure is wrongly configured?
Or do you want Joomla to set it off programatically?
Or do you want Joomla to set it off programatically?
Issue with migrating? Include logs/joomla_update.php in your report!
Blank screen? Verify pagesource for HTML code (javascript error)
Installation failing on populating database? Install with set_time_limit(0)
Document your customizations!
Blank screen? Verify pagesource for HTML code (javascript error)
Installation failing on populating database? Install with set_time_limit(0)
Document your customizations!
-
- Joomla! Apprentice
- Posts: 36
- Joined: Thu Aug 14, 2008 11:54 am
- Location: Gdańsk, Poland
- Contact:
Re: Magic Quotes GPC Off ?
Well, but this one is something which sticks out.
Anyway, in one case 5.4 solved it, in other, CP configuration of the host.
Anyway, in one case 5.4 solved it, in other, CP configuration of the host.
http://uk.webastyczny.pl - design, corporate identity, IT projects
-
- Joomla! Exemplar
- Posts: 8808
- Joined: Sat Oct 01, 2011 7:06 pm
Re: Magic Quotes GPC Off ?
Sorry, don't understand your answer, please explain.
Issue with migrating? Include logs/joomla_update.php in your report!
Blank screen? Verify pagesource for HTML code (javascript error)
Installation failing on populating database? Install with set_time_limit(0)
Document your customizations!
Blank screen? Verify pagesource for HTML code (javascript error)
Installation failing on populating database? Install with set_time_limit(0)
Document your customizations!
-
- Joomla! Apprentice
- Posts: 36
- Joined: Thu Aug 14, 2008 11:54 am
- Location: Gdańsk, Poland
- Contact:
Re: Magic Quotes GPC Off ?
This error touches something which needs editing on many hosts and not all hosts allow php.ini change.
Switching PHP to 5.4 solved this problem. The question is whether to treat this issue as an enforcerer for people to move to 5.4 or something?
Switching PHP to 5.4 solved this problem. The question is whether to treat this issue as an enforcerer for people to move to 5.4 or something?
http://uk.webastyczny.pl - design, corporate identity, IT projects
- humvee
- Joomla! Master
- Posts: 14704
- Joined: Wed Aug 17, 2005 10:27 pm
- Location: Kent, England
Re: Magic Quotes GPC Off ?
I don't believe it is an "enforcer" rather "better practice" as selected by the developers. It was a requirement for Joomla 2.5 as well, but it seems to be more specific in 3.0 with its effects.
If there is an "enforcer" as you are referring to it, it is that magic_quotes be turned off. This can be achieved in most situations without any need to move to PHP 5.4.x but does require cooperation from the host provider.
If there is an "enforcer" as you are referring to it, it is that magic_quotes be turned off. This can be achieved in most situations without any need to move to PHP 5.4.x but does require cooperation from the host provider.
-
- Joomla! Apprentice
- Posts: 36
- Joined: Thu Aug 14, 2008 11:54 am
- Location: Gdańsk, Poland
- Contact:
Re: Magic Quotes GPC Off ?
humvee OK, you know, I could list a few other "good practices" but this is the question of balance.
Well, 2.5 installed just fine wherever I wanted, nothing ever needed changes.
This is the main idea I'm talking about - the extent to which hosts will agree to make such changes. I was lucky I always use high quality hosts, not too cheap, etc.
Well, 2.5 installed just fine wherever I wanted, nothing ever needed changes.
This is the main idea I'm talking about - the extent to which hosts will agree to make such changes. I was lucky I always use high quality hosts, not too cheap, etc.
http://uk.webastyczny.pl - design, corporate identity, IT projects
- DesignGuy
- Joomla! Explorer
- Posts: 263
- Joined: Sat Sep 02, 2006 9:33 pm
- Location: Chicago, USA
- Contact:
Re: Magic Quotes GPC Off ?
Quick FYI, if you're updating your server to php 5.4.7, remember it affects all urls on your dedicated or vps. If you've got a 1.5 or 2.5 site on a different url, you may be just fine with installing Joomla 3.x on one url, but the older model Joomla-powered sites may (will) go kablooey.
John Coonen
Host, CMS Expo Learning & Business Conference - http://CMSExpo.net
Managing Director, The CMS Connection - http://CMSConnection.com
Co-founder, JoomlaChicago
Host, CMS Expo Learning & Business Conference - http://CMSExpo.net
Managing Director, The CMS Connection - http://CMSConnection.com
Co-founder, JoomlaChicago
-
- Joomla! Apprentice
- Posts: 8
- Joined: Tue Oct 09, 2012 11:32 pm
Re: Magic Quotes GPC Off ?
All of this unnecessary server tinkering is just madness!
You CAN have Magic Quotes turned on.
You CAN have Magic Quotes turned on.
Last edited by alikon on Fri Oct 12, 2012 5:00 am, edited 1 time in total.
Reason: removed link to post cause merged
Reason: removed link to post cause merged
-
- Joomla! Apprentice
- Posts: 8
- Joined: Tue Oct 09, 2012 11:32 pm
a workaround Magic Quotes and Joomla 3.0
I decided to move this into its own thread. Hopefully this saves some other people time in getting their Joomla 3.0 site up and running.
Preamble
I've been seeing quite a few questions relating to Magic Quotes needing to be turned off in order to install Joomla 3.0 Many of the responses ask you to alter the php.ini or edit other high level server config.
All of this unnecessary server tinkering is just madness!
You can't even install Joomla 3.0 without turning off Magic Quotes.
And its these kind of UX blocks that put Joomla so far backwards it's not even funny.
In many cases altering php.ini is just not possible (shared hosting etc).
Magic Quotes Enable sites have existed no problem alongside Anti Magic Quotes sites, so what changed in Joomla 3.0? Why should you alter your server config?
With some careful editing, you can turn the clock back to the way things used to be and use Joomla 3.0 with Magic Quotes turned ON!
Here's how to do it:
PART 1
IMPORTANT
However, Magic Quotes and Joomla's new special character escaping will cause duplicate escaping when editing/creating content. This renders anything that's not plain text incorrectly. So, we need to add one small condition to the core (this used to exist pre Joomla 3.0)
PART 2
If you want to learn about why Joomla is trying to force us to disable Magic Quotes then check out this link:
http://www.php.net/manual/en/security.m ... whynot.php
Preamble
I've been seeing quite a few questions relating to Magic Quotes needing to be turned off in order to install Joomla 3.0 Many of the responses ask you to alter the php.ini or edit other high level server config.
All of this unnecessary server tinkering is just madness!
You can't even install Joomla 3.0 without turning off Magic Quotes.
And its these kind of UX blocks that put Joomla so far backwards it's not even funny.
In many cases altering php.ini is just not possible (shared hosting etc).
Magic Quotes Enable sites have existed no problem alongside Anti Magic Quotes sites, so what changed in Joomla 3.0? Why should you alter your server config?
With some careful editing, you can turn the clock back to the way things used to be and use Joomla 3.0 with Magic Quotes turned ON!
Here's how to do it:
PART 1
- Step 1 Download the latest Joomla 3.0
- Step 2 Extract the files on your server
- Step 3 Open your favourite PHP editor
- Step 4 Navigate and open installation/models/setup.php
- Step 5 Scroll down to find line 234
Code: Select all
// 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;
- Step 6 Comment out the code above and save the file
IMPORTANT
However, Magic Quotes and Joomla's new special character escaping will cause duplicate escaping when editing/creating content. This renders anything that's not plain text incorrectly. So, we need to add one small condition to the core (this used to exist pre Joomla 3.0)
PART 2
- Step 1 Navigate and open libraries/joomla/filter/input.php
- Step 2 Scroll down to find line 261
Code: Select all
public function clean($source, $type = 'string')
{
// Handle the type constraint
switch (strtoupper($type))
{...
}
// -- ADD THIS CODE HERE
// Handle magic quotes compatibility
if(get_magic_quotes_gpc()) $result = self::_stripSlashesRecursive($result);
}
- Step 3 Add the code marked above to the clean function
- Step 4 You may have noticed we're only running this when Magic Quotes is set to ON and referring to a new function called _stripSlashesRecursive. Now, we need to add that function to the class.
Scroll to line 755 and add the following function:
Code: Select all
/**
* Strips slashes recursively on an array.
*
* @param array $value Array or (nested arrays) of strings.
*
* @return array The input array with stripslashes applied to it.
*
* @deprecated 12.1 - Sanctioned on 2012-10-09 thanks to Anton Wintergerst
* @since 11.1
*/
protected static function _stripSlashesRecursive($value)
{
$value = is_array($value) ? array_map(array('JFilterInput', '_stripSlashesRecursive'), $value) : stripslashes($value);
return $value;
}
http://www.php.net/manual/en/security.m ... whynot.php
Last edited by alikon on Fri Oct 12, 2012 5:02 am, edited 1 time in total.
Reason: changed title from tutorial to workaround
Reason: changed title from tutorial to workaround
- alikon
- Joomla! Champion
- Posts: 5941
- Joined: Fri Aug 19, 2005 10:46 am
- Location: Roma
- Contact:
Re: Magic Quotes GPC Off ?
@3rdlion
your proposal is a core hack and maybe expose joomla to high security risk
is a bad pratice to hack core code
your proposal is a core hack and maybe expose joomla to high security risk
is a bad pratice to hack core code