By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,643 Members | 1,797 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,643 IT Pros & Developers. It's quick & easy.

Disable magic_quotes_gpc in a .htaccess file

P: n/a
Hi All,

How do I disable magic quotes via .htaccess?

I put the following file in my webroot, but it does not disable
magic_quotes_gpc (according to phpinfo(), both the local and master value
are still "on")

<IfModule mod_php4.c>
php_value upload_max_filesize 8M
php_value magic_quotes_gpc 0
</IfModule>
The change to upload_max_filesize works (master is 2M, local value is 8M,
according to phpinfo())

Guess I've got something wrong. Any help?

-Josh
Jul 17 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Joshua Beall wrote:
Hi All,

How do I disable magic quotes via .htaccess?

I put the following file in my webroot, but it does not disable
magic_quotes_gpc (according to phpinfo(), both the local and master value
are still "on")

<IfModule mod_php4.c>
php_value upload_max_filesize 8M
php_value magic_quotes_gpc 0
</IfModule>
The change to upload_max_filesize works (master is 2M, local value is 8M,
according to phpinfo())

Guess I've got something wrong. Any help?

-Josh


Close but no cigar - try:

php_value magic_quotes_gpc off

Cheers,

James
--
Fortune cookies says:
To find out a girl's faults, praise her to her girl friends.
-- Benjamin Franklin

Jul 17 '05 #2

P: n/a
Joshua Beall wrote:
How do I disable magic quotes via .htaccess?


Unfortunately you can't change it in the .htaccess file. By the time
the .htaccess file is parsed magic quotes have already been added if the
setting is on. The only way to change the setting and have it work is to
change the Apache httpd.conf file, assuming you are able to.

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/
Jul 17 '05 #3

P: n/a

"Chris Hope" <bl*******@electrictoolbox.com> wrote in message
news:dX*****************@news.xtra.co.nz...
Joshua Beall wrote:
How do I disable magic quotes via .htaccess?


Unfortunately you can't change it in the .htaccess file. By the time
the .htaccess file is parsed magic quotes have already been added if the
setting is on.


Really? Hmm. In the documentation it lists that setting as
"PHP_INI_PERDIR", meaning it can be changed on a per directory basis with
..htaccess files.

This is not true?
Jul 17 '05 #4

P: n/a
"Centurion" <sp*******@nowhere.com> wrote in message
news:ta************@news.grayonline.id.au...
Close but no cigar - try:

php_value magic_quotes_gpc off


Bingo, that did it. Strange thing is, I thought for *sure* that is one of
the things I tried.

Anyway, thanks!
Jul 17 '05 #5

P: n/a
Joshua Beall wrote:

"Chris Hope" <bl*******@electrictoolbox.com> wrote in message
news:dX*****************@news.xtra.co.nz...
Joshua Beall wrote:
> How do I disable magic quotes via .htaccess?


Unfortunately you can't change it in the .htaccess file. By the time
the .htaccess file is parsed magic quotes have already been added if the
setting is on.


Really? Hmm. In the documentation it lists that setting as
"PHP_INI_PERDIR", meaning it can be changed on a per directory basis with
.htaccess files.

This is not true?


Actually yes you're probably correct. I was thinking of ini_set() (doh!)
where it obviously won't work. Funny thing is I just tried this now where
the default is off and tried to force it on with a .htaccess file on my
local machine and phpinfo() showed the value unchanged. Oh well, from your
response to another post looks like you got it sorted out :)

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/
Jul 17 '05 #6

P: n/a
> Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/


I took a look at your site. Some good articles.

Question: what did you do your site with? Is it a CMS of your own making?
Just curious.
Jul 17 '05 #7

P: n/a
Joshua Beall wrote:
I took a look at your site. Some good articles.

Question: what did you do your site with? Is it a CMS of your own making?
Just curious.


Yes, a CMS of my own making. I've been meaning to write about it in the
about the site section but found much more interesting things to write
about. I usually write stuff down so I don't forget it and by putting it
online it makes it easier to find again.

The CMS uses PHP and MySQL. The data is read out of MySQL using the PEAR
database objects and everything is stored into XML. That is then parsed
into HTML using an XSL stylesheet. I just need to get around to making it
all XHTML compliant now... (it's pretty close to being so).

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/
Jul 17 '05 #8

P: n/a
jn
"Joshua Beall" <jb****@donotspam.remove.me.heraldic.us> wrote in message
news:P%*****************@nwrddc03.gnilink.net...
Hi All,

How do I disable magic quotes via .htaccess?

I put the following file in my webroot, but it does not disable
magic_quotes_gpc (according to phpinfo(), both the local and master value
are still "on")

<IfModule mod_php4.c>
php_value upload_max_filesize 8M
php_value magic_quotes_gpc 0
</IfModule>

Try

php_flag magic_quotes_gpc off
Jul 17 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.