Click to See Complete Forum and Search --> : php ignores cmdline parameters


lubo999x
02-24-2003, 04:41 AM
Hi!

I have 2 php applications on my server (NT 4.0, IIS 4.0, PhP 4.0.6). Each one needs different configuration.
(Different setting of register_globals. I know I can solve it programaticaly, changing app so that it will not require register_globlas, but I want do it by changing configuration of php.)
I want to configure php in each virtual directory (server/app1; server/app2) to use different settings. I found out that -c parameter specifies from which dir php will load php.ini file.
BUT, I tried -c parameter from command line & from IIS and both didn't work. Parameter was simply IGNORED!
(I tried:
c:\php\php.exe -c c:\php e:\appdir\index.php
c:\php\php.exe -c c:\php\ e:\appdir\index.php
c:\php\php.exe -c c:\php\php.ini e:\appdir\index.php
)

Then I use parameter -d to specify at least that one different parameter. It worked form command line, but not form IIS!
In IIS when you open _properties_ of virtual directory, and then _edit_ in right bottom side you see configuration of running PhP script engine through CGI. There should be "c:\php\php.exe %s %s" for extension ".php".
(I tried:
c:\php\php.exe -c c:\php %s %s
c:\php\php.exe -c c:\php
c:\php\php.exe -c c:\php\php.ini %s %s
c:\php\php.exe -c c:\php\php.ini
c:\php\php.exe -d register_globals=off %s %s
c:\php\php.exe -d register_globals=off
... and others
)

With NO RESULT! Everything is IGNORED!
Then I tried even "c:\php\php.exe fsfkjsd fsdfksjf asfsfkas fasdkfasdf fdsfj". No result => no error message, no change!

Can anyone help me with this?
Thanx in advance.

goa103
05-15-2003, 08:12 AM
Hello,

Let me point this url to you:
http://www.faqts.com/knowledge_base/view.phtml/aid/15590

The solution has a name: Apache.
JM. Molina

tsinka
05-17-2003, 02:55 PM
Hi,

AFAIK the php releases since 4.3.0 also support to change administrative ini settings through adding keys to the registry manually:

1) open regedit
2) open HKEY_LOCAL_MACHINE\SOFTWARE
3) create a key PHP if it doesn't exist
4) create a key "Per Directory Values"
5) create a key for the drive in which DocumentRoot is without :\, e.g. C or D
6) create a key for each directory until DocumentRoot
7) create a new string value in the last key, like register_globals and assign it a value of "On" or "Off".

The complete key could look like this:

HKEY_LOCAL_MACHINE\SOFTWARE\PHP\Per Directory Values\C\Inetpub\Host1 -> register_globals="On"

Then restart IIS.

Don't know if this is still interesting for you since you posted in February. Didn't test if that all works but it might work since php-4.3.0 :)

goa103
05-19-2003, 06:32 AM
Hi,

Where did you find the information ? It's very interesting.
However PHP 4.3.0+ is kind of buggy under Windows so I still use PHP 4.2+

Thanks,
JM

tsinka
05-19-2003, 02:24 PM
Hi,

the information that it might work since php-4.3.0 can be found in the changelog:

http://www.php.net/ChangeLog-4.php

In the php 4.0 release candidate section there is a brief description of how to create the keys and all the stuff.

A more detailed howto can be found under:

http://www.dclp-faq.de/q/q-php-ini.html (german)



You want to know where I found that information ? I sometimes google :D

goa103
05-20-2003, 11:08 AM
Hi tsinka,

Nice trick! But I wonder if there's any official tool to handle php.ini paths. You can laugh but I had to build a new PHP release in order to handle more that one php.ini file! It actually works but now a better solution would be to develop a php.ini paths manager. Don't you think ?

I read the whole manual and there's nothing about it. Moreover modifying the Base Registry is not a portable solution and PHP is supposed to be cross platform so... IMHO they should do it in a cross platform way.

J googles when M elgoogs ~ www.gOogle.de ~