Link to home
Start Free TrialLog in
Avatar of Michael Wu
Michael WuFlag for United States of America

asked on

How can I set a PHP_INI_PERDIR directive on a per directory basis?

We need to allow register_globals for a few domains. the register_globals is a PHP_INI_PERDIR so it's not able to be set via Windows registry. What other options do we have?

We're running IIS on Windows 2003 with PHP 5.2
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

The meaning of those constants is shown here:

Note the second entry:

Constant             Value      Meaning
PHP_INI_USER          1          Entry can be set in user scripts or in Windows registry
PHP_INI_PERDIR   2           Entry can be set in php.ini, .htaccess or httpd.conf
PHP_INI_SYSTEM   4          Entry can be set in php.ini or httpd.conf
PHP_INI_ALL         7           Entry can be set anywhere

You can set the item through the use of an .htaccess file.  
Avatar of Michael Wu


How can you use a .htaccess file on a Windows server running IIS?
LOL!  Good point.  I had assumed Apache after not reading the whole question.  :/  There may be an equivalent model in IIS, but I'm afraid you'll have to wait for some other experts to chime in.
im not an expert but I do think an htaccess is for apache only... IIS might have a workaround but an htaccess I dont think its the way...

Try looking in the registry for something like this:
[HKLM\SOFTWARE\PHP\Per Directory Values\C\Inetpub\vhosts\]

And see if you have a value like:
This is what I have already. It shows up as correct in phpinfo.php but doesn't actually execute that way.

I have
string: register_globals
value: on
Did you check variables_order?

The default is "EGPCS".
Should I switch the order? Sorry, I'm not a good PHP person.
I ended up trying to use a separate php.ini file which means I had to switch from FastCGI mode to the php-cgi.exe mode. Now, once I did this the page stop rendering correctly. I'm getting function.include links on the page where content used to display.

Any ideas?
Avatar of Computer101
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial