note 97795 added to configuration.file
| From: | HayleyWatson at osu1 dot php dot net | Date: | Sat, 08 May 2010 22:53:41 +0000 |
| Subject: | note 97795 added to configuration.file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169079@lists.php.net to get a copy of this message | ||
"Since PHP 5.1.0, it is possible to refer to existing .ini variables from within .ini
files."
If you have several configurations that you switch between (say development/testing/staging), or
there is some other reason why several settings scattered through the .ini file might need to be
changed all together on occasion, then combining this with a custom block can bring all the bits
that need changing into one place:
[Customization]
custom.mode = "development"
custom.display_errors = "on"
custom.error_reporting = 30719
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
....
And then refer to these variables in the rest of the file:
custom.session.save_path = "/tmp/"${custom.mode}
Bringing all the changes into one location in the file is often of immense benefit.
---
Unfortunately, variable names cannot (yet) be nested. Otherwise one could have one .ini file with
several customisation blocks, and a single variable to choose which set of variables to use:
[Customization]
custom.mode = "development"
[Customization Development]
custom.development.display_errors = on
[Customization Production]
custom.development.display_errors = off
...
display_errors = ${custom.${custom.mode}.display_errors}
----
Server IP: 203.89.181.186
Probable Submitter: 122.57.192.195
----
Manual Page -- http://www.php.net/manual/en/configuration.file.php
Edit -- https://master.php.net/note/edit/97795
Del: integrated -- https://master.php.net/note/delete/97795/integrated
Del: useless -- https://master.php.net/note/delete/97795/useless
Del: bad code -- https://master.php.net/note/delete/97795/bad+code
Del: spam -- https://master.php.net/note/delete/97795/spam
Del: non-english -- https://master.php.net/note/delete/97795/non-english
Del: in docs -- https://master.php.net/note/delete/97795/in+docs
Del: other reasons-- https://master.php.net/note/delete/97795
Reject -- https://master.php.net/note/reject/97795
Search -- https://master.php.net/manage/user-notes.php