Magic Quotes GPC Off ?

Need help installing Joomla! 3.x? For all Joomla! 3.x installation issues please use this forum.

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
sovainfo
Joomla! Exemplar
Joomla! Exemplar
Posts: 8808
Joined: Sat Oct 01, 2011 7:06 pm

Re: Magic Quotes GPC Off ?

Post by sovainfo » Wed Jan 23, 2013 12:13 am

Not all providers are that quick, some will only act when loosing customers to those that do support their customers. Shouldn't be a big problem to find a provider that knows its business.
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!

bnoonan
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Tue Jan 22, 2013 8:37 pm

Re: Magic Quotes GPC Off ?

Post by bnoonan » Wed Jan 23, 2013 4:03 pm

All - I think I may have figured out what my problem was. As I mentioned before, I was unable to turn off both Register Globals & Magic Quotes GPC. Network Solutions is my host.

I tried absolutely everything-- creating a php.ini file in the root of my site, editing the .htaccess file. Adding a php.ini file to my cgi-bin. This is only a few things I did...

Anyways, I figured I would give it one more shot. Instead of connecting to my site via FTP, I decided to go through my hosts FTP Manager. Once in their, I clicked on the cgi-bin folder, and low-and-behold -- there was the php.ini file! so, I added the following:

register_globals = Off
magic_quotes_gpc = Off

After that, I deleted the file /cgi-bin/.php/php.coalesced.ini. Deleting it forces the server to re-generate it on the next PHP load.

I'm getting ready to go through the install now, but I have a good feeling this did the trick. I still don't understand why there are certain files that you can't see when you connect via FTP. I will keep everyone posted if I was successful or not.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44096
Joined: Sat Apr 05, 2008 9:58 pm

Re: Magic Quotes GPC Off ?

Post by Webdongle » Wed Jan 23, 2013 4:13 pm

bnoonan wrote:... I clicked on the cgi-bin folder, and low-and-behold -- there was the php.ini file! so, I added the following:

register_globals = Off
magic_quotes_gpc = Off

After that, I deleted the file /cgi-bin/.php/php.coalesced.ini. Deleting it forces the server to re-generate it on the next PHP load. ...
Nice one
bnoonan wrote:... I still don't understand why there are certain files that you can't see when you connect via FTP. ...
With some servers the ftp client needs the 'show hidden' setting set. Or it could be the folder your ftp login connects to is not the server root but the site root.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

bnoonan
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Tue Jan 22, 2013 8:37 pm

Re: Magic Quotes GPC Off ?

Post by bnoonan » Wed Jan 23, 2013 5:05 pm

Hey guys/girls/everyone, just wanted to give you an update:

It worked! So, for anyone using network solutions...make sure you edit your php.ini file within cgi-bin. You MUST do this from within the FTP Manager, by logging into your account on Networksolutions.com.

and you must delete the file /cgi-bin/.php/php.coalesced.ini when you are finished editing your php.ini file.

Hope this helps

User avatar
rebelojose
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sun Mar 04, 2007 7:01 pm

Re: Magic Quotes GPC Off ?

Post by rebelojose » Thu Jan 24, 2013 2:29 pm

Hola everyone,

i ask to my hosting provider about this error, and they answer it is about new version PHP 5.3

PHP 5.3 does not have this feature anymore so it is off. If you like we can transfer your account to another server that runs older PHP version.

best regards
jrebelo

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44096
Joined: Sat Apr 05, 2008 9:58 pm

Re: Magic Quotes GPC Off ?

Post by Webdongle » Thu Jan 24, 2013 2:59 pm

rebelojose wrote:...

PHP 5.3 does not have this feature anymore so it is off. If you like we can transfer your account to another server that runs older PHP version.
Then if that does not exist in php5.3 it is not on ... therefore it should show as off when you install Joomla ?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

sovainfo
Joomla! Exemplar
Joomla! Exemplar
Posts: 8808
Joined: Sat Oct 01, 2011 7:06 pm

Re: Magic Quotes GPC Off ?

Post by sovainfo » Thu Jan 24, 2013 4:31 pm

Someone reported the setting doesn't exist in PHP5.4 and discovered it needed to be turned of. Removing the setting still caused problems.
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!

julianelihu
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Fri Mar 07, 2008 6:11 am

Re: Magic Quotes GPC Off ?

Post by julianelihu » Fri Jan 25, 2013 9:02 pm

many thanks for the trick

magic_quotes_gpc = Off
session.save_path = "/tmp"

User avatar
Simsan Mallick
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 117
Joined: Sat Apr 16, 2011 9:58 am
Location: Dhaka, BD
Contact:

Re: Magic Quotes GPC Off ?

Post by Simsan Mallick » Sat Jan 26, 2013 7:59 pm

Yes, it working. :)
Thanks

spevak
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Jan 31, 2012 11:07 pm

Re: Magic Quotes GPC Off ?

Post by spevak » Sat Jan 26, 2013 10:40 pm

Worked - thanks, silicon_chip

Create php.ini file with the following lines.

magic_quotes_gpc = Off
session.save_path = "/tmp"

Copy to the Installation subfolder of your site.

User avatar
rebelojose
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sun Mar 04, 2007 7:01 pm

Re: Magic Quotes GPC Off ?

Post by rebelojose » Sat Jan 26, 2013 11:47 pm

spevak wrote:Worked - thanks, silicon_chip

Create php.ini file with the following lines.

magic_quotes_gpc = Off
session.save_path = "/tmp"

Copy to the Installation subfolder of your site.
What version php server u have?

Graham_W
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Jan 28, 2013 10:39 pm

Re: Magic Quotes GPC Off ?

Post by Graham_W » Mon Jan 28, 2013 11:10 pm

My hosting provider is very amenable, and provides these options of editing my php.ini file:

; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/magic-quotes-gpc
magic_quotes_gpc = On

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
; http://php.net/magic-quotes-runtime
magic_quotes_runtime = On

; Use Sybase-style magic quotes (escape ' with '' instead of \').
; http://php.net/magic-quotes-sybase
magic_quotes_sybase = On

Should I set all three of these to Off ?

Thanks

mjplowcha
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu Dec 18, 2008 3:03 pm

Re: Magic Quotes GPC Off ?

Post by mjplowcha » Tue Jan 29, 2013 12:41 am

This is what worked for me... (Apache Server - Php 5.3.19)

php.ini (located in Joomla Installation folder noting that you may have to make one)

Code: Select all

magic_quotes_gpc = Off;
session.save_path = "/tmp";
Add to .htaccess file: (Not htaccess.txt)

Code: Select all

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/YOURINFO/public_html/JOOMLA INSTALLATION ROOT
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>
Verify it is off on Joomla 3+ by viewing System->System Information ->PHP Information and look for the value 'magic_quotes_gpc'

:)

joombabyjoom
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Tue Nov 23, 2010 8:36 pm

I GOT IT!!!

Post by joombabyjoom » Tue Jan 29, 2013 4:20 am

Hey everybody.. this one took some time, but i finally found what worked.

Unfortunately, none of the advice previous to this post worked for me, so i'm hoping this post can help those of you who found no luck as well

(**Thanks to everyone who at least tried to help us :-))


First of all...
i think where many of us were going wrong was by updating the php.ini file.. this - for some of us - may be incorrect ... this revision should be to the php5.ini file... if you are running the latest version of php (or at least 5 and up) you should have one of these files - if not, simply create this file with the code below and all should be happy trails.


Secondly - make sure the php5.ini resides in the ROOT of your hosting account - not the site/folder you are trying to setup


Code: Select all

; Magic quotes
;

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off

; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off
[/i]


I found this fix on php.net
http://php.net/manual/en/security.magic ... abling.php


i really hope some of you can use this fix as this was very unnecessary to have to deal with.

nJoy.

eagesa
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Mon Feb 04, 2013 10:10 am

Re: a workaround Magic Quotes and Joomla 3.0

Post by eagesa » Tue Feb 05, 2013 8:48 pm

3rdlion wrote: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
  • 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
Now you can install Joomla 3.0 no problem.
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;
}
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
I have tried the above but still when saving my k2 items I still get the repeated back slashes. Do you have any solution to this that will help me? :-\

SurfingFriendly
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Oct 14, 2011 7:13 pm

Re: Magic Quotes GPC Off ?

Post by SurfingFriendly » Wed Feb 06, 2013 3:42 pm

helped me:
added a file called php.ini (created in Notepad) to the "install" Folder, with following Content:

; Magic quotes
;

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off

; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off

savedlema
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Apr 04, 2011 7:44 am

Re: Magic Quotes GPC Off ?

Post by savedlema » Sat Mar 02, 2013 10:44 pm

Thanks all for this useful topic.
I face the same problem, and this is what I did, according to silicon_chip.
I created the php.ini and uploaded it to the installation directory as in STEP 1 (and thankfully, the Magic Quote warning is off, and installation went on.)

[ii]I created another php.ini and uploaded it to the root, (no problem)
[iii] Now, in the root directory, there is htaccess.Text file there with a lot of things in it. But I could not find anything like "SetEnv PHPRC /path /to/php.ini" in it. So, I created a new .htaccess file and put the codes:"SetEnv PHPRC /home/username/public_html/php.ini" (I changed 'username' to my cpanel username.), I uploaded this file. (But this line is the only line of code in this new .htaccess file, is this okay?) Is this okay Silicon_Chip?
Thanks a lot.

larry_g1s
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Mar 11, 2013 7:49 pm

Re: Magic Quotes GPC Off ?

Post by larry_g1s » Mon Mar 11, 2013 7:55 pm

Ok...I think I read every post of these three pages. I contacted my host (Lunarpages) after trying many of the suggests here and they mentioned one of the suggestions here which was to add
magic_quotes_gpc = off
to the php.ini file and add
suPHP_ConfigPath /home/genesi2/public_html/
to the .htaccess file.

But the same thing happens as when I tried the solution from this thread, which is after I click 'check again' it goes straight to a screen saying: Congratulations! Joomla! is now installed. But I didn't install anything. And when I remove the installation folder mentioned on that same 'Congratulations! Joomla! is now installed.' page, I get errors.

savedlema
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Apr 04, 2011 7:44 am

Re: Magic Quotes GPC Off ?

Post by savedlema » Mon Mar 11, 2013 8:48 pm

Larry, my problem was solved by following what silicon_chip suggest. I suggest you follow that too.

larry_g1s
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Mar 11, 2013 7:49 pm

Re: Magic Quotes GPC Off ?

Post by larry_g1s » Mon Mar 11, 2013 9:18 pm

savedlema wrote:Larry, my problem was solved by following what silicon_chip suggest. I suggest you follow that too.
Thanks. But what 'install folder' on the site? The installation for the joomla site attempting to install or a 'install' folder on the hosting site? If it's on the hosting site, I don't have an install folder, or at least one I can see (either ftp or cpanel).

savedlema
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Apr 04, 2011 7:44 am

Re: Magic Quotes GPC Off ?

Post by savedlema » Mon Mar 11, 2013 9:47 pm

larry_g1s wrote:
savedlema wrote:Larry, my problem was solved by following what silicon_chip suggest. I suggest you follow that too.
Thanks. But what 'install folder' on the site? The installation for the joomla site attempting to install or a 'install' folder on the hosting site? If it's on the hosting site, I don't have an install folder, or at least one I can see (either ftp or cpanel).
Larry,I assume that you were trying to install the latest version of Joomla and was stuck by this magic quotes error. When you fix the error, the installation of Joomla isn't stuck anymore and so it will continue to install (Joomla). When you install Joomla there is a special folder created on the machine for installation, which you are normally asked to remove at the end of the installation.

larry_g1s
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Mar 11, 2013 7:49 pm

Re: Magic Quotes GPC Off ?

Post by larry_g1s » Mon Mar 11, 2013 10:04 pm

savedlema wrote:
larry_g1s wrote:
savedlema wrote:Larry, my problem was solved by following what silicon_chip suggest. I suggest you follow that too.
Thanks. But what 'install folder' on the site? The installation for the joomla site attempting to install or a 'install' folder on the hosting site? If it's on the hosting site, I don't have an install folder, or at least one I can see (either ftp or cpanel).
Larry,I assume that you were trying to install the latest version of Joomla and was stuck by this magic quotes error.
Thanks savedlema. Yes I'm trying to install v3.0.3 and familiar with v1.5 & v2.5 installs.
savedlema wrote:Larry,I assume that you were trying to install the latest version of Joomla and was stuck by this magic quotes error. When you fix the error, the installation of Joomla isn't stuck anymore and so it will continue to install (Joomla). When you install Joomla there is a special folder created on the machine for installation, which you are normally asked to remove at the end of the installation.
I guess that's where I'm confused. After I've "solved" the problem with the Magic Quotes by the php and .htaccess files, and then click 'check again' on the install page showing the Magic Quotes error, it directly goes to that page I described where it says 'Congratulations! Joomla! is now installed', remove installation folder, etc. But unlike prev. Joomla version (i.e. 1.5, 2.5) there isn't any steps that it goes through to add things like database, admin username and password, etc. It goes directly to that page as if I've already gone through all those steps. If I remove/rename the installation folder assuming it has correctly been installed, I get this error: Error displaying the error page: Application Instantiation Error

So basically, as far as I can tell, it doesn't go through any installation process, it just acts like it's installed after I've 'solved' the magic quotes issue.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44096
Joined: Sat Apr 05, 2008 9:58 pm

Re: Magic Quotes GPC Off ?

Post by Webdongle » Mon Mar 11, 2013 10:24 pm

http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

miasni
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Mar 18, 2013 8:17 am

Re: Magic Quotes GPC Off ?

Post by miasni » Mon Mar 18, 2013 8:27 am

I installed once in my computer and then recover the installation in internet server, as follows:

LOCAL COMPUTER
1. download the last version Joomla_3.0.3-Stable-Full_Package.zip
2. installed in my dev computer, in a standard WAMPSERVER setup.
3. with PHPMyAdmin I got a full joomla3 database backup

INTERNET SERVER
4. upload and unzipped the file in /public_html
5. delete installation folder
6. configure your database, database user, and grant proper permissions
7. recover your LOCAL COMPUTER's database backup
8. modify joomla's public_html/configuration.php



hope it helps

Risus
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Fri Jun 01, 2012 3:31 pm

Re: Magic Quotes GPC Off ?

Post by Risus » Tue Mar 26, 2013 4:00 pm

[quote="duanemitchell"]I got a solution with the help of support at Namecheap. I added this line to my .htaccess:

Code: Select all

suPHP_ConfigPath /home/username/public_html
where username is my cPanel login username.

^THIS worked perfectly. Was having the same problem (site hosted on Lunarpages) and nothing else was doing the trick, but this got the installation to move forward just fine. Thank you!

ajcmaster
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Wed Mar 20, 2013 7:03 pm

Re: Magic Quotes GPC Off ?

Post by ajcmaster » Tue Mar 26, 2013 7:42 pm

Well, I have turned magic quotes off in my server, have set the session.save_path, they are correctly shown in phpinfo(), but the installation still wont get thorugh first step.

What now?

phpinfo()

Code: Select all

magic_quotes_gpc	Off	Off
magic_quotes_runtime	Off	Off
magic_quotes_sybase	Off    Off

Code: Select all

session.save_path	/tmp	/tmp

kanjimanji
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Apr 08, 2013 10:37 am

Re: Magic Quotes GPC Off ?

Post by kanjimanji » Mon Apr 08, 2013 10:46 am

@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.
Thank you, kind sir, you just saved me god knows how many hours editing files and going back and forth with my hosting company.

Is there a way to create universal php.ini that affects both site and admin files?

shaids
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Thu Apr 11, 2013 11:15 am

Re: Magic Quotes GPC Off ?

Post by shaids » Thu Apr 11, 2013 2:17 pm

Hi, What if the installation folder is not there. what can i do next??/

thanks

jedlarosa
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Sat Dec 04, 2010 8:21 am

Re: Magic Quotes GPC Off ?

Post by jedlarosa » Mon Apr 22, 2013 2:12 pm

Can someone please send me the edited .htaccess for turning off that GPC QUOTES PLEASE? I DONT KNOW HOW TO DO IT! please help me! Have mercy! :-(
Web Developer

the_observer
Joomla! Apprentice
Joomla! Apprentice
Posts: 41
Joined: Mon Feb 05, 2007 11:21 am

Re: Magic Quotes GPC Off ?

Post by the_observer » Tue Apr 23, 2013 10:57 am

humvee wrote: 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!
Hi all ,

i am on a shared hosting and the only way to alter php settings is by php.ini files. As far as i have read and understand this works on a per directory basis.

So, in order for joomla 3 to work smoothly and mainly securely (including third party addons plugins e.t.c.) are we sure that the php.ini file has to be put only in the two above mentioned directories (joomla_root/ and /joomla_root/administrator/) ?

Thank you for your time reading this and excuse my lame English.

Regards,
the_observer.


Locked

Return to “Installation Joomla! 3.x”