note 60993 added to ini.core

From: Date: Mon, 23 Jan 2006 01:07:10 +0000
Subject: note 60993 added to ini.core
Groups: php.notes 
Request: Send a blank email to php-notes+get-102253@lists.php.net to get a copy of this message
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! ---- Server IP: 64.71.164.2 Probable Submitter: 67.85.62.196 ---- Manual Page -- http://www.php.net/manual/en/ini.core.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60993 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60993&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60993&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60993&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60993&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60993&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60993&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60993&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60993&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102253) next »