Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28650 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 853 invoked by uid 1010); 2 Apr 2007 12:52:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 837 invoked from network); 2 Apr 2007 12:52:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Apr 2007 12:52:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=jani.taskinen@sci.fi; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jani.taskinen@sci.fi; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sci.fi from 63.208.196.171 cause and error) X-PHP-List-Original-Sender: jani.taskinen@sci.fi X-Host-Fingerprint: 63.208.196.171 outbound.mailhop.org FreeBSD 4.6-4.9 Received: from [63.208.196.171] ([63.208.196.171:4007] helo=outbound.mailhop.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/7C-07466-57CF0164 for ; Mon, 02 Apr 2007 08:52:06 -0400 Received: from [81.22.163.71] (helo=[10.6.109.17]) by outbound.mailhop.org with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.63) (envelope-from ) id 1HYM0w-000Lre-J1 for internals@lists.php.net; Mon, 02 Apr 2007 08:52:02 -0400 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 81.22.163.71 X-Report-Abuse-To: abuse@dyndns.com (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: jtaskine Reply-To: sniper@iki.fi To: internals@lists.php.net Content-Type: multipart/mixed; boundary="=-Cb+XkX4TJLD4aHQRfITr" Date: Mon, 02 Apr 2007 15:51:25 +0300 Message-ID: <1175518285.3717.4.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.3 (2.8.3-1.fc6) Subject: [PATCH] Allowing --with-config-file-path=/this/is/full/path/phpfoobar.ini (ie. allows also any name instead of php.ini) From: jani.taskinen@sci.fi (Jani Taskinen) --=-Cb+XkX4TJLD4aHQRfITr Content-Type: text/plain Content-Transfer-Encoding: 7bit Patch attached as usual, should be quite self-exlaining. :D --Jani --=-Cb+XkX4TJLD4aHQRfITr Content-Disposition: attachment; filename=main_php_ini_c.patch Content-Type: text/x-patch; name=main_php_ini_c.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: php_ini.c =================================================================== RCS file: /repository/php-src/main/php_ini.c,v retrieving revision 1.136.2.4.2.7 diff -u -r1.136.2.4.2.7 php_ini.c --- php_ini.c 24 Feb 2007 02:17:28 -0000 1.136.2.4.2.7 +++ php_ini.c 2 Apr 2007 12:48:31 -0000 @@ -258,6 +258,7 @@ */ int php_init_config(TSRMLS_D) { + char *default_location = NULL; char *php_ini_file_name = NULL; char *php_ini_search_path = NULL; int safe_mode_state; @@ -292,7 +293,6 @@ free_ini_search_path = 0; } else if (!sapi_module.php_ini_ignore) { int search_path_size; - char *default_location; char *env_location; char *binary_location; static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 }; @@ -424,11 +424,11 @@ PG(open_basedir) = NULL; memset(&fh, 0, sizeof(fh)); - /* Check if php_ini_path_override is a file */ if (!sapi_module.php_ini_ignore) { + struct stat statbuf; + + /* Check if php_ini_path_override is a file */ if (php_ini_file_name && php_ini_file_name[0]) { - struct stat statbuf; - if (!VCWD_STAT(php_ini_file_name, &statbuf)) { if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) { fh.handle.fp = VCWD_FOPEN(php_ini_file_name, "r"); @@ -438,6 +438,21 @@ } } } +#ifndef PHP_WIN32 + /* Check if PHP_CONFIG_FILE_PATH points to a file */ + if (default_location && default_location[0] && + default_location[strlen(default_location)-1] != '/' + ) { + if (!VCWD_STAT(default_location, &statbuf)) { + if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) { + fh.handle.fp = VCWD_FOPEN(default_location, "r"); + if (fh.handle.fp) { + fh.filename = php_ini_opened_path = expand_filepath(default_location, NULL TSRMLS_CC); + } + } + } + } +#endif /* Search php-%sapi-module-name%.ini file in search path */ if (!fh.handle.fp) { const char *fmt = "php-%s.ini"; --=-Cb+XkX4TJLD4aHQRfITr--