note 60993 deleted from ini.core by nlopess

From: Date: Mon, 23 Jan 2006 11:27:18 +0000
Subject: note 60993 deleted from ini.core by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-102277@lists.php.net to get a copy of this message
Note Submitter: edwardzyang at thewritingpot dot com ---- The configuration option auto_prepend_file brings up some interesting possibilities for centralized version specific configuration. Here's the problem: you have about 15 installations of PHP. Each of them has slightly different ini files: nothing major like a magic_quotes_gpc or register_globals change, but the little things that add up here and there. At this point, maintaining 15 files is too much. You want to point all your installations to one ini file, but that won't work due to the *tiny* little changes you have. Create a new prepend.php file, and set auto_prepend_file to that. Then, in that file, do version testing and set extra ini settings or extension loading with dl(). You have your core in php.ini, and then smart extra loading in the prepend file. Example: <?php // Better version detection is possible!!! $coarse_version = substr(PHP_VERSION, 0, 3); if ($coarse_version == '4.3') { dl('..\..\xdebug\xdebug-4.3-1.3.2.dll'); } elseif ($coarse_version == '5.0') { dl('..\..\xdebug\xdebug-5.0-2.0.0beta1.dll'); } else { //don't load xdebug extension } ?> Caveats with the example: it doesn't load XDebug as a zend_extension, and while most of the functionality will still be there (var_dump formatting, error traces, function nesting protection), stuff that requires Zend engine level will not work (remote debugging, step in/out, watch/break). Don't try this on a production machine, kiddies!

« previous php.notes (#102277) next »