~legolas/ubuntu/natty/php5/5.3.5

« back to all changes in this revision

Viewing changes to sapi/fpm/fpm/fpm_main.c

  • Committer: Stas Verberkt
  • Date: 2011-02-01 09:27:15 UTC
  • Revision ID: legolas@legolasweb.nl-20110201092715-yq052iu2yl4i2eyg
Inserted PHP 5.3.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
        {'?', 0, "usage"},/* help alias (both '?' and 'usage') */
153
153
        {'v', 0, "version"},
154
154
        {'y', 1, "fpm-config"},
 
155
        {'t', 0, "test"},
 
156
        {'p', 1, "prefix"},
155
157
        {'-', 0, NULL} /* end of args */
156
158
};
157
159
 
166
168
        HashTable user_config_cache;
167
169
        char *error_header;
168
170
        char *fpm_config;
169
 
        struct event_base *event_base;
170
171
} php_cgi_globals_struct;
171
172
 
172
173
/* {{{ user_config_cache
959
960
                prog = "php";
960
961
        }
961
962
 
962
 
        php_printf(     "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-c <file>] [-d foo[=bar]] [-y <file>]\n"
 
963
        php_printf(     "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix> ] [-c <file>] [-d foo[=bar]] [-y <file>]\n"
963
964
                                "  -c <path>|<file> Look for php.ini file in this directory\n"
964
965
                                "  -n               No php.ini file will be used\n"
965
966
                                "  -d foo[=bar]     Define INI entry foo with value 'bar'\n"
968
969
                                "  -i               PHP information\n"
969
970
                                "  -m               Show compiled in modules\n"
970
971
                                "  -v               Version number\n"
 
972
                                "  -p, --prefix <dir>\n"
 
973
                                "                   Specify alternative prefix path to FastCGI process manager (default: %s).\n"
971
974
                                "  -y, --fpm-config <file>\n"
972
 
                                "                   Specify alternative path to FastCGI process manager config file.\n",
973
 
                                prog);
 
975
                                "                   Specify alternative path to FastCGI process manager config file.\n"
 
976
                                "  -t, --test       Test FPM configuration and exit\n",
 
977
                                prog, PHP_PREFIX);
974
978
}
975
979
/* }}} */
976
980
 
1372
1376
                int mode = ZEND_INI_USER;
1373
1377
                char *tmp;
1374
1378
                spprintf(&tmp, 0, "%s\n", ini);
1375
 
                zend_parse_ini_string(tmp, 1, ZEND_INI_SCANNER_RAW, (zend_ini_parser_cb_t)fastcgi_ini_parser, &mode TSRMLS_CC);
 
1379
                zend_parse_ini_string(tmp, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t)fastcgi_ini_parser, &mode TSRMLS_CC);
1376
1380
                efree(tmp);
1377
1381
        }
1378
1382
 
1381
1385
                int mode = ZEND_INI_SYSTEM;
1382
1386
                char *tmp;
1383
1387
                spprintf(&tmp, 0, "%s\n", ini);
1384
 
                zend_parse_ini_string(tmp, 1, ZEND_INI_SCANNER_RAW, (zend_ini_parser_cb_t)fastcgi_ini_parser, &mode TSRMLS_CC);
 
1388
                zend_parse_ini_string(tmp, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t)fastcgi_ini_parser, &mode TSRMLS_CC);
1385
1389
                efree(tmp);
1386
1390
        }
1387
1391
}
1406
1410
                return;
1407
1411
        }
1408
1412
 
1409
 
        if (!value || strlen(value) < 1) {
 
1413
        if (!value) {
1410
1414
                fprintf(stderr, "Passing INI directive through FastCGI: empty value for key '%s'\n", key);
1411
1415
                return;
1412
1416
        }
1480
1484
{
1481
1485
        php_info_print_table_start();
1482
1486
        php_info_print_table_row(2, "php-fpm", "active");
1483
 
        php_info_print_table_row(2, "php-fpm version", PHP_FPM_VERSION);
1484
1487
        php_info_print_table_end();
1485
1488
 
1486
1489
        DISPLAY_INI_ENTRIES();
1548
1551
        int fcgi_fd = 0;
1549
1552
        fcgi_request request;
1550
1553
        char *fpm_config = NULL;
 
1554
        char *fpm_prefix = NULL;
 
1555
        int test_conf = 0;
1551
1556
 
1552
1557
        fcgi_init();
1553
1558
 
1585
1590
                                }
1586
1591
                                cgi_sapi_module.php_ini_path_override = strdup(php_optarg);
1587
1592
                                break;
 
1593
 
1588
1594
                        case 'n':
1589
1595
                                cgi_sapi_module.php_ini_ignore = 1;
1590
1596
                                break;
 
1597
 
1591
1598
                        case 'd': {
1592
1599
                                /* define ini entries on command line */
1593
1600
                                int len = strlen(php_optarg);
1619
1626
                                }
1620
1627
                                break;
1621
1628
                        }
 
1629
 
1622
1630
                        case 'y':
1623
1631
                                fpm_config = php_optarg;
1624
1632
                                break;
1625
1633
 
 
1634
                        case 'p':
 
1635
                                fpm_prefix = php_optarg;
 
1636
                                break;
 
1637
 
1626
1638
                        case 'e': /* enable extended info output */
1627
1639
                                CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
1628
1640
                                break;
1629
1641
 
 
1642
                        case 't': 
 
1643
                                test_conf++;
 
1644
                                break;
 
1645
 
1630
1646
                        case 'm': /* list compiled in modules */
1631
1647
                                cgi_sapi_module.startup(&cgi_sapi_module);
1632
1648
                                php_output_startup();
1763
1779
                }
1764
1780
        }
1765
1781
 
1766
 
        if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), &CGIG(event_base))) {
 
1782
        if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, test_conf)) {
1767
1783
                return FAILURE;
1768
1784
        }
1769
1785
 
1770
 
        fcgi_fd = fpm_run(&max_requests, CGIG(event_base));
 
1786
        fcgi_fd = fpm_run(&max_requests);
1771
1787
        parent = 0;
1772
1788
        fcgi_set_is_fastcgi(1);
1773
1789
 
1920
1936
out:
1921
1937
 
1922
1938
        SG(server_context) = NULL;
1923
 
        php_module_shutdown(TSRMLS_C);
1924
 
        sapi_shutdown();
 
1939
        if (parent) {
 
1940
                php_module_shutdown(TSRMLS_C);
 
1941
                sapi_shutdown();
 
1942
        }
1925
1943
 
1926
1944
#ifdef ZTS
1927
1945
        tsrm_shutdown();