[PHP-CVS] cvs: php-src /sapi/cgi README.FastCGI cgi_main.c
tony2001Mon Feb 19 20:01:18 2007 UTC Modified files: /php-src/sapi/cgi README.FastCGI cgi_main.c Log: MFB: Eliminate strcat() usage Fixed handling of argv[] for GET http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/README.FastCGI?r1=1.5r2=1.6diff_format=u Index: php-src/sapi/cgi/README.FastCGI diff -u php-src/sapi/cgi/README.FastCGI:1.5 php-src/sapi/cgi/README.FastCGI:1.6 --- php-src/sapi/cgi/README.FastCGI:1.5 Mon Jul 24 12:15:28 2006 +++ php-src/sapi/cgi/README.FastCGI Mon Feb 19 20:01:17 2007 @@ -69,7 +69,7 @@ Don't load mod_php, by the way. Make sure it is commented out! -#LoadModule php5_module /usr/lib/apache/2.0/libphp5.so +#LoadModule php6_module /usr/lib/apache/2.0/libphp6.so Now, we'll create a fcgi-bin directory, just like you would do with normal CGI scripts. You'll need to create a directory somewhere to store your http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.311r2=1.312diff_format=u Index: php-src/sapi/cgi/cgi_main.c diff -u php-src/sapi/cgi/cgi_main.c:1.311 php-src/sapi/cgi/cgi_main.c:1.312 --- php-src/sapi/cgi/cgi_main.c:1.311 Mon Feb 19 14:13:35 2007 +++ php-src/sapi/cgi/cgi_main.c Mon Feb 19 20:01:17 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: cgi_main.c,v 1.311 2007/02/19 14:13:35 dmitry Exp $ */ +/* $Id: cgi_main.c,v 1.312 2007/02/19 20:01:17 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -836,11 +836,11 @@ env_script_name = pt + l; /* PATH_TRANSATED = DOCUMENT_ROOT + PATH_INFO */ - path_translated_len = l + strlen(env_path_info) + 2; - path_translated = (char *) emalloc(path_translated_len); - *path_translated = 0; - strncat(path_translated, env_document_root, l); - strcat(path_translated, env_path_info); + path_translated_len = l + strlen(env_path_info); + path_translated = (char *) emalloc(path_translated_len + 1); + memcpy(path_translated, env_document_root, l); + memcpy(path_translated + l, env_path_info, (path_translated_len - l)); + path_translated[path_translated_len] = '\0'; if (orig_path_translated) { _sapi_cgibin_putenv(ORIG_PATH_TRANSLATED, orig_path_translated TSRMLS_CC); } @@ -851,13 +851,13 @@ ) { /* PATH_TRANSATED = PATH_TRANSATED - SCRIPT_NAME + PATH_INFO */ int ptlen = strlen(pt) - strlen(env_script_name); - int path_translated_len = ptlen + strlen(env_path_info) + 2; + int path_translated_len = ptlen + strlen(env_path_info); char *path_translated = NULL; - path_translated = (char *) emalloc(path_translated_len); - *path_translated = 0; - strncat(path_translated, pt, ptlen); - strcat(path_translated, env_path_info); + path_translated = (char *) emalloc(path_translated_len + 1); + memcpy(path_translated, pt, ptlen); + memcpy(path_translated + ptlen, env_path_info, path_translated_len - ptlen); + path_translated[path_translated_len] = '\0'; if (orig_path_translated) { _sapi_cgibin_putenv(ORIG_PATH_TRANSLATED, orig_path_translated TSRMLS_CC); } @@ -1559,17 +1559,22 @@ test.php v1=test v2=hello world! */ if (!SG(request_info).query_string
[PHP-CVS] cvs: php-src /sapi/cgi README.FastCGI
dmitry Mon Jul 24 12:15:28 2006 UTC Modified files: /php-src/sapi/cgi README.FastCGI Log: Documentation fix http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/README.FastCGI?r1=1.4r2=1.5diff_format=u Index: php-src/sapi/cgi/README.FastCGI diff -u php-src/sapi/cgi/README.FastCGI:1.4 php-src/sapi/cgi/README.FastCGI:1.5 --- php-src/sapi/cgi/README.FastCGI:1.4 Sat Jan 17 13:00:10 2004 +++ php-src/sapi/cgi/README.FastCGI Mon Jul 24 12:15:28 2006 @@ -126,17 +126,22 @@ performance of FastCGI PHP. The following are environment variables that can be set before running the PHP binary: -PHP_FCGI_CHILDREN (default value: 8) +PHP_FCGI_CHILDREN (default value: 0) This controls how many child processes the PHP process spawns. When the fastcgi starts, it creates a number of child processes which handle one -page request at a time. So by default, you will be able to handle 8 -concurrent PHP page requests. Further requests will be queued. -Increasing this number will allow for better concurrency, especially if you -have pages that take a significant time to create, or supply a lot of data -(e.g. downloading huge files via PHP). On the other hand, having more -processes running will use more RAM, and letting too many PHP pages be -generated concurrently will mean that each request will be slow. +page request at a time. Value 0 means that PHP willnot start additional +processes and main process will handle FastCGI requests by itself. Note that +this process may die (because of PHP_FCGI_MAX_REQUESTS) and it willnot +respawned automatic. Values 1 and above force PHP start additioanl processes +those will handle requests. The main process will restart children in case of +their death. So by default, you will be able to handle 1 concurrent PHP page +requests. Further requests will be queued. Increasing this number will allow +for better concurrency, especially if you have pages that take a significant +time to create, or supply a lot of data (e.g. downloading huge files via PHP). +On the other hand, having more processes running will use more RAM, and letting +too many PHP pages be generated concurrently will mean that each request will +be slow. PHP_FCGI_MAX_REQUESTS (default value: 500) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /sapi/cgi README.FastCGI
sas Wed Sep 3 04:24:37 2003 EDT Modified files: /php-src/sapi/cgi README.FastCGI Log: Update documentation, -b ip:port works Index: php-src/sapi/cgi/README.FastCGI diff -u php-src/sapi/cgi/README.FastCGI:1.2 php-src/sapi/cgi/README.FastCGI:1.3 --- php-src/sapi/cgi/README.FastCGI:1.2 Tue Nov 26 00:51:15 2002 +++ php-src/sapi/cgi/README.FastCGI Wed Sep 3 04:24:37 2003 @@ -25,13 +25,22 @@ In this setup, PHP is started as a separate process entirely from the web server. It will listen on a socket for new FastCGI requests, and deliver PHP pages as appropriate. This is the recommended way of running PHP-FastCGI. -To run this way, you must start the PHP binary running by giving it a port -number to listen to on the command line, e.g.: +To run this way, you must start the PHP binary running by giving it an IP +and a port number to listen to on the command line, e.g.: -./php -b 8002 +./php -b 127.0.0.1:8002 -(you can also specify a bind address, e.g. ./php -b localhost:8002. However, this - relies on the FastCGI devkit and does not seem to work properly) +The above line is the recommended way of running FastCGI. You usually +want the FastCGI server to provide services to the localhost, not +everyone on the Internet. + +If your web server sits on a remote host, you can make FastCGI listen +on all interfaces: + +./php -b :8002 +./php -b *:8002 + +Note that hostnames are not supported. You must also configure your web server to connect to the appropriate port in order to talk to the PHP FastCGI process. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php