#41444 [Opn]: Version specific php.ini files
| From: | geoff dot garside at openhosting dot co dot uk | Date: | Sat, 19 May 2007 21:39:20 +0000 |
| Subject: | #41444 [Opn]: Version specific php.ini files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112862@lists.php.net to get a copy of this message | ||
ID: 41444
User updated by: geoff dot garside at openhosting dot co dot uk
Reported By: geoff dot garside at openhosting dot co dot uk
Status: Open
Bug Type: Feature/Change Request
Operating System: any
PHP Version: 4.4.7
New Comment:
I have written a patch which provides this. The patch is against
version 4.4.7 and I have a similar one for PHP 5.2.2 if required but
the code is the same.
I can't see anywhere to simply attach files, so I will paste it here.
--- main/php_ini.c.orig 2007-05-14 20:51:28.000000000 +0100
+++ main/php_ini.c 2007-05-14 21:06:20.000000000 +0100
@@ -395,6 +395,17 @@
fh.filename = php_ini_opened_path;
}
}
+ /* Search php%PHP_MAJOR_VERSION%.ini file in search path */
+ if (!fh.handle.fp) {
+ const char *fmt = "php%d.ini";
+ char *ini_fname = emalloc(strlen(fmt) + 3); /* Should be
good until PHP v999.0 */
+ sprintf(ini_fname, fmt, PHP_MAJOR_VERSION);
+ fh.handle.fp = php_fopen_with_path(ini_fname, "r",
php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
+ efree(ini_fname);
+ if (fh.handle.fp) {
+ fh.filename = php_ini_opened_path;
+ }
+ }
/* Search php.ini file in search path */
if (!fh.handle.fp) {
fh.handle.fp = php_fopen_with_path("php.ini", "r",
php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
Previous Comments:
------------------------------------------------------------------------
[2007-05-19 21:29:32] geoff dot garside at openhosting dot co dot uk
Description:
------------
Some web hosting companies want to run both PHP 4 and PHP 5 on their
servers, In these cases it would be useful for PHP to search for a
phpX.ini file where X is the value of the PHP_MAJOR_VERSION. This would
make it easier for both server admins as well as clients to create
separate configs for different versions of PHP within their websites.
I have selected version 4.4.7 as I am required to choose a version, but
this should equally pertain to PHP 5.2.2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41444&edit=1