Reusing PHP configuration [not solved]

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Reusing PHP configuration [not solved]

Post 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?
Last edited by Ambush Commander on Tue Jan 24, 2006 2:15 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

If you are running Apache 2, you can tell it what ini file to use.


Moved to Web Servers.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Can Apache tell PHP to use multiple INI files?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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()
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

so long as the dl() function hasn't been disabled, you should be able to load an extension you require at runtime..
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

but wouldn't you set that option across the board?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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. :(
Post Reply