1
twitaman
How I Got Rid of My Annoying Quotation \\\ Problems: magic_quotes
  • 2005/2/3 17:08

  • twitaman

  • Friend of XOOPS

  • Posts: 270

  • Since: 2004/7/28


Okay, this is probably for all the relatively new people like me who have run into problems with many modules that utilize quotation marks ' ". You know what happens, you type don't in your content and it appears as don'\t by adding the annoying backslashes. This quirk nearly cost me to toss out XOOPS at the 11th hour and try some other CMS. I know I've seen a lot of people asking questions about this and there have been various answers but nothing seems clear and upfront to me. So after asking a lot of questions to more knowledgeable folks and doing Google searches here is what I did to fix my backslash problem!!!

1) Assess the problem. Are you having a problem with backslashes? If you are, you are having a magic_quotes problem. I won't go into the why or sordid history behind magic_quotes but suffice is to say, it's a leftover bit of code which now causes a whole lot of trouble. When magic_quotes are set to on they cause the backslash problem.

2) There are 3 magic_quotes settings that are usually the culprits: magic_quotes_gpc, magic_quotes_sybase, and magic_quotes_runtime. Now, (and correct me on this if I'm wrong, people with more knowledge) when anyone of these is set to on. You're going to get the problem. So you have to figure out which one is set to on (they could all be set to on, or only one of them, it depends on your server). To check this, in your browser type: http://www.YOURSITE.com/phpinfo.php. This will return your php settings.

3) Under "Configuration PHP Core" you will see various php directives in alphabetical order. Note which magic_quotes settings are set to "on." In my case, only magic_quotes_gpc was set to "on."

4) If you have access to php.ini then you can change this yourself. But more than likely you will not have this access unless you have a dedicated server. You'll then have to notify your service provider and asks them to turn magic_quotes_gpc (in this case) to "off" by having them change the php.ini. If your service provider is like my bunch of a**holes they'll tell you pretty much to go to hell or upgrade to a dedicated server plan so that you can change it. If you're like me, you cannot afford that -- so what do you do?

5) You can change magic_quotes locally with an .htaccess file. htaccess files are hidden files on your server. If you have ftp access you'll have to enable the ability to view hidden files to see if there is an .htaccess file already in your XOOPS root folder. If you do not have one (like in my case) then you will have to create your own .htaccess file with the appropriate magic_quotes codes.

6) Open Notepad or SimpleText and add the lines you need. In my case, I just opened a Notepad file and typed: magic_quotes_gpc off.

7) Save your file by naming it. .htaccess. (For more information on .htaccess files, check this out: https://xoops.org/modules/smartfaq/faq.php?faqid=190) Remember, it's not .htaccess dot a file extension name, like say, .htaccess.txt. It's just .htacess! No file extension.

8) Upload your file to your XOOPS root folder (it may be another folder though depending on where your XOOPS site is). In my case I just needed to put my .htaccess file in public_html. CHMOD should be set to 644 Note, it's important to upload your file in ASCII format not Binary!

9) That's it! At least it was in my case. If you're still having problems make sure you have done everything correctly. Consult the .htaccess XOOPS faq. Also, check this out https://xoops.org.cn/modules/wordpress/index.php?p=91

2
seth_sd
Re: How I Got Rid of My Annoying Quotation \\\ Problems: magic_quotes
  • 2005/2/3 17:16

  • seth_sd

  • Friend of XOOPS

  • Posts: 158

  • Since: 2004/11/9


Perfectly said...You write very clear documentation.

3
DonXoop
Re: How I Got Rid of My Annoying Quotation \\\ Problems: magic_quotes

Thanks for the writeup.
FYI, the .htaccess line that works on most Apache servers is:

php_flag magic_quotes_gpc 0

If you only have one or a couple of modules that this will help you can place the .htaccess file at that directory level (i.e. /modules/agendax/.htaccess). This is safer and slightly better performing.

4
twitaman
Re: How I Got Rid of My Annoying Quotation \\\ Problems: magic_quotes
  • 2005/2/3 19:34

  • twitaman

  • Friend of XOOPS

  • Posts: 270

  • Since: 2004/7/28


Thanks for the clarification!

Quote:

DonXoop wrote:
Thanks for the writeup.
FYI, the .htaccess line that works on most Apache servers is:

php_flag magic_quotes_gpc 0

If you only have one or a couple of modules that this will help you can place the .htaccess file at that directory level (i.e. /modules/agendax/.htaccess). This is safer and slightly better performing.

5
brash
Re: How I Got Rid of My Annoying Quotation \\\ Problems: magic_quotes
  • 2005/2/3 22:02

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Hey, glad to hear you got this resolved Twitaman . I wasn't too far off with the .htaccess syntax I gave you then? Don't know where that came from as I'm an IIS man .

6
twitaman
Re: How I Got Rid of My Annoying Quotation \\\ Problems: magic_quotes
  • 2005/2/3 22:09

  • twitaman

  • Friend of XOOPS

  • Posts: 270

  • Since: 2004/7/28


Yeah, thanks a lot Dom for pointing me in the right direction! It's the little things that will drive you mad about this, and figuring out the dreaded quotation/apostrophe problem really relieves a BIG part of my stress.

7
brash
Re: How I Got Rid of My Annoying Quotation \\\ Problems: magic_quotes
  • 2005/2/3 22:27

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Just shows you how information is passed along. It was only 6 months ago when testing the update scripts in AMS before the release of 2.2 that I came along a very similar issue and Mith showed me the joys magic_quotes can cause on a system . Before that I'd never heard of it.

Login

Who's Online

339 user(s) are online (256 user(s) are browsing Support Forums)


Members: 0


Guests: 339


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits