From: Yasuo Ohgaki Date: Fri, 12 Apr 2002 00:20:29 +0000 (+0000) Subject: CGI/CLI take file and dir for -c option by this. X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~704 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=439b56842f394759f7c74c71bc61d418c54d4b65;p=php CGI/CLI take file and dir for -c option by this. @ Both 'file' and 'path to php.ini' is allowed for "-c" cli/cgi option. (Yasuo) --- diff --git a/main/php_ini.c b/main/php_ini.c index ba24ea260b..d440d5abde 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -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); } diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 3004468fb4..7661565a6f 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -327,21 +327,21 @@ static void php_cgi_usage(char *argv0) } php_printf("Usage: %s [-q] [-h] [-s [-v] [-i] [-f ] | { [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 Parse . Implies `-q'\n" - " -v Version number\n" - " -C Do not chdir to the script's directory\n" - " -c 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 Load Zend extension .\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 Parse . Implies `-q'\n" + " -v Version number\n" + " -C Do not chdir to the script's directory\n" + " -c | 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 Load Zend extension .\n" + " -l Syntax check only (lint)\n" + " -m Show compiled in modules\n" + " -i PHP information\n" + " -h This help\n", prog); } /* }}} */ diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 42a40a637a..6e4c2a3ca3 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -240,27 +240,27 @@ static void php_cli_usage(char *argv0) } else { prog = "php"; } - + php_printf( "Usage: %s [options] [-f] [args...]\n" " %s [options] -r [args...]\n" " %s [options] [-- args...]\n" - " -s Display colour syntax highlighted source.\n" - " -w Display source with stripped comments and whitespace.\n" - " -f Parse .\n" - " -v Version number\n" - " -c 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 Load Zend extension .\n" - " -l Syntax check only (lint)\n" - " -m Show compiled in modules\n" - " -i PHP information\n" - " -r Run PHP 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 Parse .\n" + " -v Version number\n" + " -c | 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 Load Zend extension .\n" + " -l Syntax check only (lint)\n" + " -m Show compiled in modules\n" + " -i PHP information\n" + " -r Run PHP 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); } /* }}} */