Yasuo Ohgaki wrote:
> Currently, we can only specify path to "php.ini".
> 
> This patch allows to specify file for a config file
> when SAPI is CLI.

Since we don't want needless inconsistency, CGI
should behave as CLI when it's possbile.

CGI & CLI take both path and file for -c option.

Here is new patch.
Any comments?

--
Yasuo Ohgaki




Index: main/php_ini.c
===================================================================
RCS file: /repository/php4/main/php_ini.c,v
retrieving revision 1.80
diff -u -r1.80 php_ini.c
--- main/php_ini.c      5 Mar 2002 00:21:28 -0000       1.80
+++ main/php_ini.c      11 Apr 2002 14:01:32 -0000
@@ -262,8 +262,13 @@
 
        PG(safe_mode) = 0;
        PG(open_basedir) = NULL;
-       
-       fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, 
&php_ini_opened_path TSRMLS_CC);
+
+       fh.handle.fp = NULL;
+       if (php_ini_path_override && !php_ini_path_override[0]) {
+               fh.handle.fp = VCWD_FOPEN(php_ini_path_override, "r");
+       }
+       if (!fh.handle.fp)
+               fh.handle.fp = php_fopen_with_path("php.ini", "r", 
+php_ini_search_path, &php_ini_opened_path TSRMLS_CC);
        if (free_ini_search_path) {
                efree(php_ini_search_path);
        }
Index: sapi/cli/php_cli.c
===================================================================
RCS file: /repository/php4/sapi/cli/php_cli.c,v
retrieving revision 1.18
diff -u -r1.18 php_cli.c
--- sapi/cli/php_cli.c  27 Mar 2002 22:49:21 -0000      1.18
+++ sapi/cli/php_cli.c  11 Apr 2002 14:01:33 -0000
@@ -244,23 +244,23 @@
        php_printf( "Usage: %s [options] [-f] <file> [args...]\n"
                    "       %s [options] -r <code> [args...]\n"
                    "       %s [options] [-- args...]\n"
-                               "  -s             Display colour syntax highlighted 
source.\n"
-                               "  -w             Display source with stripped 
comments and whitespace.\n"
-                               "  -f <file>      Parse <file>.\n"
-                               "  -v             Version number\n"
-                               "  -c <path>      Look for php.ini file in this 
directory\n"
-                               "  -a             Run interactively\n"
-                               "  -d foo[=bar]   Define INI entry foo with value 
'bar'\n"
-                               "  -e             Generate extended information for 
debugger/profiler\n"
-                               "  -z <file>      Load Zend extension <file>.\n"
-                               "  -l             Syntax check only (lint)\n"
-                               "  -m             Show compiled in modules\n"
-                               "  -i             PHP information\n"
-                               "  -r <code>      Run PHP <code> without using script 
tags <?..?>\n"
-                               "  -h             This help\n"
+                               "  -s               Display colour syntax highlighted 
+source.\n"
+                               "  -w               Display source with stripped 
+comments and whitespace.\n"
+                               "  -f <file>        Parse <file>.\n"
+                               "  -v               Version number\n"
+                               "  -c <path>|<file> Look for php.ini file in this 
+directory\n"
+                               "  -a               Run interactively\n"
+                               "  -d foo[=bar]     Define INI entry foo with value 
+'bar'\n"
+                               "  -e               Generate extended information for 
+debugger/profiler\n"
+                               "  -z <file>        Load Zend extension <file>.\n"
+                               "  -l               Syntax check only (lint)\n"
+                               "  -m               Show compiled in modules\n"
+                               "  -i               PHP information\n"
+                               "  -r <code>        Run PHP <code> without using 
+script tags <?..?>\n"
+                               "  -h               This help\n"
                                "\n"
-                               "  args...        Arguments passed to script. Use -- 
args when first argument \n"
-                               "                 starts with - or script is read from 
stdin\n"
+                               "  args...          Arguments passed to script. Use -- 
+args when first argument \n"
+                               "                   starts with - or script is read 
+from stdin\n"
                                , prog, prog, prog);
 }
 /* }}} */
Index: sapi/cgi/cgi_main.c
===================================================================
RCS file: /repository/php4/sapi/cgi/cgi_main.c,v
retrieving revision 1.157
diff -u -r1.157 cgi_main.c
--- sapi/cgi/cgi_main.c 2 Apr 2002 16:45:10 -0000       1.157
+++ sapi/cgi/cgi_main.c 11 Apr 2002 14:01:33 -0000
@@ -327,21 +327,21 @@
        }
 
        php_printf("Usage: %s [-q] [-h] [-s [-v] [-i] [-f <file>] |  {<file> 
[args...]}\n"
-                               "  -q             Quiet-mode.  Suppress HTTP Header 
output.\n"
-                               "  -s             Display colour syntax highlighted 
source.\n"
-                               "  -w             Display source with stripped 
comments and whitespace.\n"
-                               "  -f <file>      Parse <file>.  Implies `-q'\n"
-                               "  -v             Version number\n"
-                "  -C             Do not chdir to the script's directory\n"
-                               "  -c <path>      Look for php.ini file in this 
directory\n"
-                               "  -a             Run interactively\n"
-                               "  -d foo[=bar]   Define INI entry foo with value 
'bar'\n"
-                               "  -e             Generate extended information for 
debugger/profiler\n"
-                               "  -z <file>      Load Zend extension <file>.\n"
-                               "  -l             Syntax check only (lint)\n"
-                               "  -m             Show compiled in modules\n"
-                               "  -i             PHP information\n"
-                               "  -h             This help\n", prog);
+                               "  -q               Quiet-mode.  Suppress HTTP Header 
+output.\n"
+                               "  -s               Display colour syntax highlighted 
+source.\n"
+                               "  -w               Display source with stripped 
+comments and whitespace.\n"
+                               "  -f <file>        Parse <file>.  Implies `-q'\n"
+                               "  -v               Version number\n"
+                "  -C               Do not chdir to the script's directory\n"
+                               "  -c <path>|<file> Look for php.ini file in this 
+directory\n"
+                               "  -a               Run interactively\n"
+                               "  -d foo[=bar]     Define INI entry foo with value 
+'bar'\n"
+                               "  -e               Generate extended information for 
+debugger/profiler\n"
+                               "  -z <file>        Load Zend extension <file>.\n"
+                               "  -l               Syntax check only (lint)\n"
+                               "  -m               Show compiled in modules\n"
+                               "  -i               PHP information\n"
+                               "  -h               This help\n", prog);
 }
 /* }}} */
 

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to