cvs: php4 /sapi/cgi cgi_main.c

From: Date: Tue, 22 May 2001 23:05:09 +0000
Subject: cvs: php4 /sapi/cgi cgi_main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5942@lists.php.net to get a copy of this message
shane Tue May 22 16:05:09 2001 EDT Modified files: /php4/sapi/cgi cgi_main.c Log: The -c commandline option was not working at all, need to set the path override before calling on the module startup. Index: php4/sapi/cgi/cgi_main.c diff -u php4/sapi/cgi/cgi_main.c:1.110 php4/sapi/cgi/cgi_main.c:1.111 --- php4/sapi/cgi/cgi_main.c:1.110 Sat May 19 07:30:32 2001 +++ php4/sapi/cgi/cgi_main.c Tue May 22 16:05:08 2001 @@ -417,9 +417,6 @@ setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */ #endif - if (php_module_startup(&cgi_sapi_module)==FAILURE) { - return FAILURE; - } /* Make sure we detect we are a cgi - a bit redundancy here, but the default case is that we have to check only the first one. */ @@ -433,7 +430,29 @@ } else { argv0 = NULL; } + } + + if (!cgi) { + while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) { + switch (c) { + case 'c': + cgi_sapi_module.php_ini_path_override = strdup(ap_php_optarg); + break; + } + + } + ap_php_optind = orig_optind; + ap_php_optarg = orig_optarg; + } + + /* startup after we get the above ini override se we get things right */ + if (php_module_startup(&cgi_sapi_module)==FAILURE) { + return FAILURE; + } + #if FORCE_CGI_REDIRECT + /* check force_cgi after startup, so we have proper output */ + if (cgi) { /* Apache will generate REDIRECT_STATUS, * Netscape and redirect.so will generate HTTP_REDIRECT_STATUS. * redirect.so and installation instructions available from @@ -460,21 +479,8 @@ return FAILURE; } -#endif /* FORCE_CGI_REDIRECT */ - } - - if (!cgi) { - while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) { - switch (c) { - case 'c': - cgi_sapi_module.php_ini_path_override = strdup(ap_php_optarg); - break; - } - - } - ap_php_optind = orig_optind; - ap_php_optarg = orig_optarg; } +#endif /* FORCE_CGI_REDIRECT */ #ifdef ZTS compiler_globals = ts_resource(compiler_globals_id); @@ -581,8 +587,8 @@ break; case 'm': /* list compiled in modules */ - php_output_startup(); - SG(headers_sent) = 1; + php_output_startup(); + SG(headers_sent) = 1; php_printf("Running PHP %s\n%s\n", PHP_VERSION , get_zend_version()); php_printf("[PHP Modules]\n"); zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void *)) _print_module_info, NULL);

« previous php.cvs (#5942) next »