File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 2323if (!isset ($ _SERVER ['argc ' ])) {
2424 die ("Command line only \n" );
2525}
26- if ($ _SERVER ['argc ' ]<2 ) {
26+
27+ function print_usage_and_exit () {
2728 echo "Usage: " .$ _SERVER ['argv ' ][0 ]." URI \n\n" ;
2829 echo "Ex: " .$ _SERVER ['argv ' ][0 ]." localhost:9000/status \n" ;
29- echo "Ex: " .$ _SERVER ['argv ' ][0 ]." unix:/var/run/php-fpm/web.sock/status \n" ;
30+ echo "Ex: " .$ _SERVER ['argv ' ][0 ]." unix:/var/run/php-fpm/web.sock /status \n" ;
3031 exit (1 );
3132}
3233
33- if (preg_match ('|^unix:(.*.sock)(/.*)$| ' , $ _SERVER ['argv ' ][1 ], $ reg )) {
34- $ url = parse_url ($ reg [2 ]);
34+ if ($ _SERVER ['argc ' ]<2 ) {
35+ print_usage_and_exit ();
36+ }
37+
38+ if (preg_match ('|^unix:(.*)$| ' , $ _SERVER ['argv ' ][1 ], $ reg )) {
39+ if ($ _SERVER ['argc ' ] < 3 ) {
40+ print_usage_and_exit ();
41+ }
42+ $ url = parse_url ($ _SERVER ['argv ' ][2 ]);
3543 $ sock = $ reg [1 ];
3644 if (!file_exists ($ sock )) {
3745 die ("UDS $ sock not found \n" );
You can’t perform that action at this time.
0 commit comments