I am managing multiple domains under Apache, and wanted to know of a way either with apache or php.ini to be able to turn on and turn off register globals per each domain... is this possible?

Thanks, Ryan

    5 days later

    In case anyone was interested, i found a solution. I have a separate vhost.conf file for each vhost. And in that file, i have this:

    <Directory /home/httpd/vhosts/domain.com/httpdocs>
    AllowOverride All
    php_admin_flag register_globals on
    </Directory>

    So in the php.ini file i have it set to off, then any domain that I need to turn on the globals, i add that to the vhost.conf file...

    Hope this helps someone...

    Ryan

      I was going to suggest that or an htaccess file.

      For those who don't have access to their apache config files, you can create a .htaccess file and place it in your web directory on the server.

      php_admin_flag register_globals on

      • keith

        there is another via PHP coding..

        ini_set ( "register_globals", "1")
          3 years later
          keith73 wrote:

          I was going to suggest that or an htaccess file.

          For those who don't have access to their apache config files, you can create a .htaccess file and place it in your web directory on the server.

          php_admin_flag register_globals on

          • keith

          when i put
          "php_admin_flag register_globals on" in .htaccess,

          It shows 500 internal error. how can i fix it?

          I am using Linux: Fedora

            when i put
            "php_admin_flag register_globals on" in .htaccess,

            It shows 500 internal error. how can i fix it?

            ummm...remove it???

            Try enterume's suggestion instead or update apache config file if you have access.

              10 days later
              kamhang wrote:

              when i put
              "php_admin_flag register_globals on" in .htaccess,

              It shows 500 internal error. how can i fix it?

              I am using Linux: Fedora

              Probably the OS isn't as important as your PHP and Apache versions.

              With one older box I have, for example, the syntax was: "php_value register_globals 1" in the httpd.conf <VirtualHost></VirtualHost> section....

                2 years later
                kamhang wrote:

                when i put
                "php_admin_flag register_globals on" in .htaccess,

                It shows 500 internal error. how can i fix it?

                I am using Linux: Fedora

                Apache documentation has this nifty little thing called contexts. Some configuration directives work in certain contexts. Some contexts include global config, vhost config, .htaccess configs, et al. php_admin* will only work in a vhost context and not .htaccess. There for it wont work.

                HOWEVER!!! you can use the ini_set() function in your php code to turn this on.

                  Write a Reply...