register globals with a php.ini file in folder

Posted on 2007-08-03
Last Modified: 2008-01-09

I realize that it is a stupid thing to do but I have to enable register globals in a directory and ALL sub-directories.

I know this can be done with .htaccess but I also heard that I could put a file called "php.ini" in the folder.

How can I do this?  What should I place in the php.ini file of the directory?
Question by:hankknight
    LVL 4

    Expert Comment

    You would probably need a full php.ini file. Depending on the webhost you are using some might not allow this functionality and some will only allow you to use .htaccess but anyways...

    The command to turn this on in the php file is:

    register_globals = on
    LVL 2

    Accepted Solution

    [I have to enable register globals in a directory and ALL sub-directories]

    Custom php.ini affects only the current folder it is residing into and not the sub directories. You will need separate php.ini files into each sub directories.

    Instead put the following line in .htaccess and it will affect all the sub directories too.

    php_flag register_globals On

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now