]> granicus.if.org Git - php/commitdiff
CGI/CLI take file and dir for -c option by this.
authorYasuo Ohgaki <yohgaki@php.net>
Fri, 12 Apr 2002 00:20:29 +0000 (00:20 +0000)
committerYasuo Ohgaki <yohgaki@php.net>
Fri, 12 Apr 2002 00:20:29 +0000 (00:20 +0000)
@ Both 'file' and 'path to php.ini' is allowed for "-c" cli/cgi option. (Yasuo)

main/php_ini.c
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c

index ba24ea260b93bcca7ee3880e36b1513644de536e..d440d5abde7d1b6f3f8737d810363a967e4e494d 100644 (file)
@@ -262,8 +262,15 @@ int php_init_config(char *php_ini_path_override)
 
        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;
+       /* Check if php_ini_path_override is a file */
+       if (php_ini_path_override && !php_ini_path_override[0]) {
+               fh.handle.fp = VCWD_FOPEN(php_ini_path_override, "r");
+       }
+       /* 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);
        if (free_ini_search_path) {
                efree(php_ini_search_path);
        }
index 3004468fb4b80e48b5618e3668c71fbf0d35d5a2..7661565a6f8f3a11598ad0852bcbdfd4022b3098 100644 (file)
@@ -327,21 +327,21 @@ static void php_cgi_usage(char *argv0)
        }
 
        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);
 }
 /* }}} */
 
index 42a40a637a08b70db9ab6a8b44d4856cf12f5ff9..6e4c2a3ca334f36ffd69483674396ee31354a213 100644 (file)
@@ -240,27 +240,27 @@ static void php_cli_usage(char *argv0)
        } else {
                prog = "php";
        }
-
+       
        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);
 }
 /* }}} */