Page 1 of 1

Reusing PHP configuration [not solved]

Posted: Sat Jan 21, 2006 6:58 pm
by Ambush Commander
Maintaining 12 copies of nearly duplicate files was a bit absurd I decided, so I did several things. First thing I did was strip out all configuration (trust the defaults) except the stuff I had changed. Next, I uninstalled a few extensions that were kinda weird or that I didn't use (if I needed to use them, I could always reenable).

Now, I need to propogate these changes to as many versions of PHP as feasible.

The problem is this one line:

Code: Select all

zend_extension_ts = "C:\php\xdebug\xdebug-4.3-1.3.2.dll" ; XDebug is useful
XDebug is installed in a way that is version specific to 4.3, which means that I would only be able to reuse this particular ini file over 4.3.* installations. A lot of these configurations, however, could carry over into 4.4 and beyond.

Ideally, I would have this setup:

core.ini

php4.ini
php5.ini

php4.3.ini
php4.4.ini
php5.0.ini
php5.1.ini

And then version specific ini files. Unfortunantely, PHP doesn't seem to allow multiple ini files! Anyone have any suggestions?

Posted: Sat Jan 21, 2006 8:36 pm
by feyd
If you are running Apache 2, you can tell it what ini file to use.


Moved to Web Servers.

Posted: Sat Jan 21, 2006 8:37 pm
by Ambush Commander
Can Apache tell PHP to use multiple INI files?

Posted: Sat Jan 21, 2006 8:44 pm
by feyd
not directly... however you could add an auto-prepend or maybe just include a library that looks at the specific version of php being used and tweaks any settings needed (provided they are permitted) by loading up the addendum ini and passes it through parse_ini_file()

Posted: Sat Jan 21, 2006 8:53 pm
by Ambush Commander
Hmm... (I'm talking about auto-prepend) so that means you can load extensions on runtime with PHP? I hate to think of the overhead this would have...

Posted: Sat Jan 21, 2006 9:06 pm
by feyd
so long as the dl() function hasn't been disabled, you should be able to load an extension you require at runtime..

Posted: Sat Jan 21, 2006 9:59 pm
by Ambush Commander
Hmm... it really isn't what I exactly was expected, but it's a possible solution.

Edit - the whole idea, really, seems silly, but after thinking about it, it will work, except for configuration options that cannot be done at runtime. Sadly, magic_quotes, one of the most important ones of all, isn't one of them.

Posted: Sat Jan 21, 2006 10:10 pm
by feyd
but wouldn't you set that option across the board?

Posted: Sun Jan 22, 2006 10:08 am
by Ambush Commander
Yes. :D

Edit - at first I was skeptical, but it *does* seem to work for the zend_extension... so what am I missing out of by calling it as if it were an extension rather than a zend_extension_ts?

Posted: Sun Jan 22, 2006 8:37 pm
by Ambush Commander
Okay, I've run into problems with zend_extension and friends. It seems that they are not configurable at runtime using dl(). :( And plus, they're some of the few things that change. :( What to do...

BTW, auto_prepend_file is not (just added) working great!

Edit - I'm not going to triple post, but at this point, auto_prepend file has become untenable. When loading PHP as a SAPI module, PHP (for some strange reason), starts looking in C:\php4\ext\ for extensions (previously, when extension_dir="ext", it would look in PHP_DIRECTORY\ext). This means that php.ini files configured for SAPI must be individually created.

I've got an idea for the solution: dynamically generate the ini file on a version change. But it'll require a bit more coding. :(