Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Mar 2002
    Location
    Sacramento, California, USA
    Posts
    509
    Thanks
    4
    Thanked 1 Time in 1 Post
    I'm trying to figure out how to turn on magic quotes for a particular directory, using Apache 2.2.

    My .htaccess file contains this (copied from another such file):

    # PHP 5, Apache 1 and 2.
    <IfModule mod_php5.c>
    php_value magic_quotes_gpc 1
    </IfModule>

    I know that Apache is finding the file, because when I create an error in the file I get a "Server configuration error" screen. But without an error in the file, phpinfo reports that magic_quotes_gpc is "off".

    I thought that httpd.conf must have disallowed setting changes in this directory, but that doesn't appear to be the case. httpd.conf contains the following (the pathname refers to the directory in question):

    <Directory "D:/htdocs/utils">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>

    What should I look for?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by jsachs177 View Post
    <IfModule mod_php5.c>
    php_value magic_quotes_gpc 1
    </IfModule>
    Based on samples using off, I suggest changing 1 to on and seeing whether that works.

    But apparently it is not good to use this feature: PHP: Why not to use Magic Quotes - Manual.

  3. #3
    4 Star Lounger
    Join Date
    Mar 2002
    Location
    Sacramento, California, USA
    Posts
    509
    Thanks
    4
    Thanked 1 Time in 1 Post
    I appreciate the reasons for not using magic quotes, but I've inherited a site that's running live -- on a server where magic quotes is turned on. I need to duplicate that environment on my development system.

    It would be nicer to make the site work with magic quotes turned off, then turn them off on the server, but I'm just trying to make the site work adequately until I can develop a replacement for it, so that type of project wouldn't make sense.

    It now appears that the <IfModule> block is not getting executed. Although putting an invalid command at the start of the file yields a server config error, I can put any sort of garbage inside the <IfModule> block without effect.

    I suspect that mod_php5.c is the wrong IfModule value, but it's not clear how to find the right one. I searched httpd.conf and found no reference to a php module at all. (This is the version of Apache that gets installed with Zend Studio 5.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •