Disable magic_quotes_gpc in a .htaccess file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joshua Beall

    Disable magic_quotes_gpc in a .htaccess file

    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_gp c (according to phpinfo(), both the local and master value
    are still "on")

    <IfModule mod_php4.c>
    php_value upload_max_file size 8M
    php_value magic_quotes_gp c 0
    </IfModule>


    The change to upload_max_file size works (master is 2M, local value is 8M,
    according to phpinfo())

    Guess I've got something wrong. Any help?

    -Josh


  • Centurion

    #2
    Re: Disable magic_quotes_gp c in a .htaccess file

    Joshua Beall wrote:
    [color=blue]
    > 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_gp c (according to phpinfo(), both the local and master value
    > are still "on")
    >
    > <IfModule mod_php4.c>
    > php_value upload_max_file size 8M
    > php_value magic_quotes_gp c 0
    > </IfModule>
    >
    >
    > The change to upload_max_file size works (master is 2M, local value is 8M,
    > according to phpinfo())
    >
    > Guess I've got something wrong. Any help?
    >
    > -Josh[/color]

    Close but no cigar - try:

    php_value magic_quotes_gp c off

    Cheers,

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

    Comment

    • Chris Hope

      #3
      Re: Disable magic_quotes_gp c in a .htaccess file

      Joshua Beall wrote:
      [color=blue]
      > How do I disable magic quotes via .htaccess?[/color]

      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

      Comment

      • Joshua Beall

        #4
        Re: Disable magic_quotes_gp c in a .htaccess file


        "Chris Hope" <blackhole@elec trictoolbox.com > wrote in message
        news:dXT8c.568$ Tf3.12581@news. xtra.co.nz...[color=blue]
        > Joshua Beall wrote:
        >[color=green]
        > > How do I disable magic quotes via .htaccess?[/color]
        >
        > 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.[/color]

        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?


        Comment

        • Joshua Beall

          #5
          Re: Disable magic_quotes_gp c in a .htaccess file

          "Centurion" <spam_this@nowh ere.com> wrote in message
          news:tascj1-9il.ln1@news.gr ayonline.id.au. ..[color=blue]
          > Close but no cigar - try:
          >
          > php_value magic_quotes_gp c off[/color]

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

          Anyway, thanks!


          Comment

          • Chris Hope

            #6
            Re: Disable magic_quotes_gp c in a .htaccess file

            Joshua Beall wrote:
            [color=blue]
            >
            > "Chris Hope" <blackhole@elec trictoolbox.com > wrote in message
            > news:dXT8c.568$ Tf3.12581@news. xtra.co.nz...[color=green]
            >> Joshua Beall wrote:
            >>[color=darkred]
            >> > How do I disable magic quotes via .htaccess?[/color]
            >>
            >> 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.[/color]
            >
            > 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?[/color]

            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

            Comment

            • Joshua Beall

              #7
              Re: Disable magic_quotes_gp c in a .htaccess file

              > Chris Hope[color=blue]
              > The Electric Toolbox Ltd
              > http://www.electrictoolbox.com/[/color]

              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.


              Comment

              • Chris Hope

                #8
                Re: Disable magic_quotes_gp c in a .htaccess file

                Joshua Beall wrote:
                [color=blue]
                > 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.[/color]

                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

                Comment

                • jn

                  #9
                  Re: Disable magic_quotes_gp c in a .htaccess file

                  "Joshua Beall" <jbeall@donotsp am.remove.me.he raldic.us> wrote in message
                  news:P%I8c.4490 $Hm4.1862@nwrdd c03.gnilink.net ...[color=blue]
                  > 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_gp c (according to phpinfo(), both the local and master value
                  > are still "on")
                  >
                  > <IfModule mod_php4.c>
                  > php_value upload_max_file size 8M
                  > php_value magic_quotes_gp c 0
                  > </IfModule>
                  >[/color]
                  Try

                  php_flag magic_quotes_gp c off


                  Comment

                  Working...