diff options
author | Peter Kokot <peterkokot@gmail.com> | 2018-10-13 14:16:33 +0200 |
---|---|---|
committer | Peter Kokot <peterkokot@gmail.com> | 2018-10-13 14:16:33 +0200 |
commit | 3362620b5f8716ce480b6f12269596c2d2351a52 (patch) | |
tree | 775f03a346d980fda9b2c725349f3c51c06bfaed /sapi | |
parent | edefd16fbc96d2ca4600544e5d5902591bf0695d (diff) | |
download | php-git-3362620b5f8716ce480b6f12269596c2d2351a52.tar.gz |
Trim trailing whitespace in source code files
Diffstat (limited to 'sapi')
-rw-r--r-- | sapi/apache2handler/README | 22 | ||||
-rw-r--r-- | sapi/cgi/README.FastCGI | 4 | ||||
-rw-r--r-- | sapi/cgi/cgi_main.c | 6 | ||||
-rw-r--r-- | sapi/cli/README | 4 | ||||
-rw-r--r-- | sapi/cli/php.1.in | 102 | ||||
-rw-r--r-- | sapi/embed/EXPERIMENTAL | 6 | ||||
-rw-r--r-- | sapi/fpm/Makefile.frag | 2 | ||||
-rw-r--r-- | sapi/fpm/php-fpm.8.in | 16 | ||||
-rw-r--r-- | sapi/fpm/status.html.in | 24 | ||||
-rw-r--r-- | sapi/fpm/tests/fcgi.inc | 2 | ||||
-rw-r--r-- | sapi/litespeed/README.md | 110 | ||||
-rw-r--r-- | sapi/litespeed/lsapilib.c | 88 | ||||
-rw-r--r-- | sapi/litespeed/lscriu.h | 10 | ||||
-rw-r--r-- | sapi/phpdbg/.phpdbginit | 16 | ||||
-rwxr-xr-x | sapi/phpdbg/phpdbg.init.d | 2 | ||||
-rw-r--r-- | sapi/phpdbg/web-bootstrap.php | 8 | ||||
-rw-r--r-- | sapi/phpdbg/xml.md | 2 |
17 files changed, 212 insertions, 212 deletions
diff --git a/sapi/apache2handler/README b/sapi/apache2handler/README index 4defa336c6..d624141c9f 100644 --- a/sapi/apache2handler/README +++ b/sapi/apache2handler/README @@ -3,7 +3,7 @@ WHAT IS THIS? This module exploits the layered I/O support in Apache 2.0. HOW DOES IT WORK? - + In Apache 2.0, you have handlers which generate content (like reading a script from disk). The content goes then through a chain of filters. PHP can be such a filter, so that it processes @@ -12,10 +12,10 @@ HOW DOES IT WORK? DOES IT WORK? - Currently the issues with the module are: + Currently the issues with the module are: * Thread safety of external PHP modules - * The lack of re-entrancy of PHP. due to this I have disabled the 'virtual' - function, and tried to stop any method where a php script can run another php + * The lack of re-entrancy of PHP. due to this I have disabled the 'virtual' + function, and tried to stop any method where a php script can run another php script while it is being run. @@ -36,15 +36,15 @@ HOW TO INSTALL $ cd php-4.x $ ./configure --with-apxs2=/path/to/apache-2.0/bin/apxs $ make install - + At the end of conf/httpd.conf, add: AddType application/x-httpd-php .php If you would like to enable source code highlighting functionality add: - + AddType application/x-httpd-php-source .phps - + That's it. Now start bin/httpd. HOW TO CONFIGURE @@ -57,15 +57,15 @@ HOW TO CONFIGURE PHPINIDir "conf" DEBUGGING APACHE AND PHP - + To debug Apache, we recommend: 1. Use the Prefork MPM (Apache 1.3-like process model) by configuring Apache with '--with-mpm=prefork'. 2. Start httpd using -DONE_PROCESS (e.g. (gdb) r -DONE_PROCESS). - If you want to debug a part of the PHP startup procedure, set a - breakpoint on 'load_module'. Step through it until apr_dso_load() is + If you want to debug a part of the PHP startup procedure, set a + breakpoint on 'load_module'. Step through it until apr_dso_load() is done. Then you can set a breakpoint on any PHP-related symbol. TODO @@ -73,4 +73,4 @@ TODO PHP functions like apache_sub_req (see php_functions.c) Source Code Highlighting Protocol handlers - + diff --git a/sapi/cgi/README.FastCGI b/sapi/cgi/README.FastCGI index f0f11e102d..4d34ff3dac 100644 --- a/sapi/cgi/README.FastCGI +++ b/sapi/cgi/README.FastCGI @@ -91,8 +91,8 @@ use the above configuration, but rather the following. Alias /fcgi-bin/ /space/fcgi-bin/ FastCgiServer /path/to/php-cgi -processes 5 -For either of the above configurations, we need to tell Apache to -use the FastCGI binary /fcgi-bin/php to deliver PHP pages. +For either of the above configurations, we need to tell Apache to +use the FastCGI binary /fcgi-bin/php to deliver PHP pages. All that is needed is: AddType application/x-httpd-fastphp .php diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 336bee186c..9e7d7726df 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -2134,8 +2134,8 @@ consult the installation file that came with this distribution, or visit \n\ int i; ZeroMemory(&kid_cgi_ps, sizeof(kid_cgi_ps)); - kids = children < WIN32_MAX_SPAWN_CHILDREN ? children : WIN32_MAX_SPAWN_CHILDREN; - + kids = children < WIN32_MAX_SPAWN_CHILDREN ? children : WIN32_MAX_SPAWN_CHILDREN; + InitializeCriticalSection(&cleanup_lock); SetConsoleCtrlHandler(fastcgi_cleanup, TRUE); @@ -2242,7 +2242,7 @@ consult the installation file that came with this distribution, or visit \n\ WaitForMultipleObjects(kids, kid_cgi_ps, FALSE, INFINITE); } - + parent_loop_end: /* restore my env */ SetEnvironmentVariable("PHP_FCGI_CHILDREN", kid_buf); diff --git a/sapi/cli/README b/sapi/cli/README index 8720250f6a..5b303aa82d 100644 --- a/sapi/cli/README +++ b/sapi/cli/README @@ -1,5 +1,5 @@ The CLI (command line interface) SAPI has been introduced -with a goal of making PHP better at supporting the creation of +with a goal of making PHP better at supporting the creation of stand alone applications. It is based on CGI SAPI with all CGI specific things removed. @@ -11,7 +11,7 @@ The main differences between the two: * It does not change the working directory to that of the script. (-C switch kept for compatibility) * Plain text error message -* $argc and $argv registered irrespective of the register_argc_argv +* $argc and $argv registered irrespective of the register_argc_argv php.ini setting. * implicit_flush always on * -r option which allows execution of PHP code directly from diff --git a/sapi/cli/php.1.in b/sapi/cli/php.1.in index 5d82093c0a..88a43d30cb 100644 --- a/sapi/cli/php.1.in +++ b/sapi/cli/php.1.in @@ -8,32 +8,32 @@ [options] [ .B \-f\fP ] .IR file -[[\-\-] +[[\-\-] .IR args.\|.\|. ] .LP .B @program_prefix@php -[options] -.B \-r +[options] +.B \-r .IR code [[\-\-] .IR args.\|.\|. ] .LP .B @program_prefix@php -[options] [\-B +[options] [\-B .IR begin_code ] -.B \-R +.B \-R .IR code -[\-E +[\-E .IR end_code ] [[\-\-] .IR args.\|.\|. ] .LP .B @program_prefix@php -[options] [\-B +[options] [\-B .IR begin_code ] -.B \-F +.B \-F .IR file -[\-E +[\-E .IR end_code ] [[\-\-] .IR args.\|.\|. ] @@ -51,39 +51,39 @@ .IR docroot ] .LP .SH DESCRIPTION -\fBPHP\fP is a widely\-used general\-purpose scripting language that is especially suited for +\fBPHP\fP is a widely\-used general\-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This is the command line interface that enables you to do the following: .P -You can parse and execute files by using parameter \-f followed by the name of the -.IR file +You can parse and execute files by using parameter \-f followed by the name of the +.IR file to be executed. .LP -Using parameter \-r you can directly execute PHP -.IR code +Using parameter \-r you can directly execute PHP +.IR code simply as you would do inside a .B \.php -file when using the -.B eval() +file when using the +.B eval() function. .LP It is also possible to process the standard input line by line using either the parameter \-R or \-F. In this mode each separate input line causes the -.IR code -specified by \-R or the +.IR code +specified by \-R or the .IR file specified by \-F to be executed. You can access the input line by \fB$argn\fP. While processing the input lines -.B $argi +.B $argi contains the number of the actual line being processed. Further more -the parameters \-B and \-E can be used to execute +the parameters \-B and \-E can be used to execute .IR code (see \-r) before and after all input lines have been processed respectively. Notice that the input is read from .B STDIN -and therefore reading from -.B STDIN +and therefore reading from +.B STDIN explicitly changes the next input line or skips input lines. .LP PHP also contains an built-in web server for application development purpose. By using the \-S option where @@ -92,9 +92,9 @@ point to a local address and port PHP will listen to HTTP requests on that addre .B docroot passed by the \-t option. .LP -If none of \-r \-f \-B \-R \-F \-E or \-S is present but a single parameter is given -then this parameter is taken as the filename to parse and execute (same as -with \-f). If no parameter is present then the standard input is read and +If none of \-r \-f \-B \-R \-F \-E or \-S is present but a single parameter is given +then this parameter is taken as the filename to parse and execute (same as +with \-f). If no parameter is present then the standard input is read and executed. .SH OPTIONS .TP 15 @@ -140,8 +140,8 @@ Measure execution time of script repeated count times (CGI only). .TP .PD 1 .B \-c \fIpath\fP|\fIfile\fP -Look for -.B php.ini +Look for +.B php.ini file in the directory .IR path or use the specified @@ -152,8 +152,8 @@ or use the specified .TP .PD 1 .B \-n -No -.B php.ini +No +.B php.ini file will be used .TP .PD 0 @@ -161,8 +161,8 @@ file will be used .TP .PD 1 .B \-d \fIfoo\fP[=\fIbar\fP] -Define INI entry -.IR foo +Define INI entry +.IR foo with value .IR bar .TP @@ -174,7 +174,7 @@ Generate extended information for debugger/profiler .TP .PD 1 .B \-f \fIfile\fP -Parse and execute +Parse and execute .IR file .TP .PD 0 @@ -189,8 +189,8 @@ This help .TP .PD 1 .B \-H -Hide script name (\fIfile\fP) and parameters (\fIargs\.\.\.\fP) from external -tools. For example you may want to use this when a php script is started as +Hide script name (\fIfile\fP) and parameters (\fIargs\.\.\.\fP) from external +tools. For example you may want to use this when a php script is started as a daemon and the command line contains sensitive data such as passwords. .TP .PD 0 @@ -219,7 +219,7 @@ Show compiled in modules .TP .PD 1 .B \-r \fIcode\fP -Run PHP +Run PHP .IR code without using script tags .B '<?..?>' @@ -229,7 +229,7 @@ without using script tags .TP .PD 1 .B \-B \fIbegin_code\fP -Run PHP +Run PHP .IR begin_code before processing input lines .TP @@ -238,7 +238,7 @@ before processing input lines .TP .PD 1 .B \-R \fIcode\fP -Run PHP +Run PHP .IR code for every input line .TP @@ -247,7 +247,7 @@ for every input line .TP .PD 1 .B \-F \fIfile\fP -Parse and execute +Parse and execute .IR file for every input line .TP @@ -256,7 +256,7 @@ for every input line .TP .PD 1 .B \-E \fIend_code\fP -Run PHP +Run PHP .IR end_code after processing all input lines .TP @@ -300,14 +300,14 @@ Output source with stripped comments and whitespace .TP .PD 1 .B \-z \fIfile\fP -Load Zend extension +Load Zend extension .IR file .TP .IR args.\|.\|. -Arguments passed to script. Use +Arguments passed to script. Use .B '\-\-' .IR args -when first argument starts with +when first argument starts with .B '\-' or script is read from stdin .TP @@ -369,7 +369,7 @@ Show configuration file names The configuration file for the CLI version of PHP. .TP .B php.ini -The standard configuration file will only be used when +The standard configuration file will only be used when .B php\-cli.ini cannot be found. .SH EXAMPLES @@ -388,24 +388,24 @@ have such a function. For dba use: .RE .TP \fI@program_prefix@php \-R 'echo strip_tags($argn)."\\n";'\fP -This PHP command strips off the HTML tags line by line and outputs the +This PHP command strips off the HTML tags line by line and outputs the result. To see how it works you can first look at the following PHP command \'\fIphp \-d html_errors=1 \-i\fP\' which uses PHP to output HTML formatted -configuration information. If you then combine those two +configuration information. If you then combine those two \'\fIphp \.\.\.|php \.\.\.\fP\' you'll see what happens. .TP \fI@program_prefix@php \-E 'echo "Lines: $argi\\n";'\fP Using this PHP command you can count the lines being input. .TP \fI@program_prefix@php \-R '@$l+=count(file($argn));' \-E 'echo "Lines:$l\\n";'\fP -In this example PHP expects each input line being a file. It counts all lines -of the files specified by each input line and shows the summarized result. +In this example PHP expects each input line being a file. It counts all lines +of the files specified by each input line and shows the summarized result. You may combine this with tools like find and change the php scriptlet. .TP \fI@program_prefix@php \-R 'echo "$argn\\n"; fgets(STDIN);'\fP -Since you have access to STDIN from within \-B \-R \-F and \-E you can skip -certain input lines with your code. But note that in such cases $argi only -counts the lines being processed by php itself. Having read this you will +Since you have access to STDIN from within \-B \-R \-F and \-E you can skip +certain input lines with your code. But note that in such cases $argi only +counts the lines being processed by php itself. Having read this you will guess what the above program does: skipping every second input line. .SH TIPS You can use a shebang line to automatically invoke php @@ -449,7 +449,7 @@ A List of active developers can be found here: .B http://www.php.net/credits.php .PD 1 .P -And last but not least PHP was developed with the help of a huge amount of +And last but not least PHP was developed with the help of a huge amount of contributors all around the world. .SH VERSION INFORMATION This manpage describes \fBphp\fP, version @PHP_VERSION@. diff --git a/sapi/embed/EXPERIMENTAL b/sapi/embed/EXPERIMENTAL index 293159a693..3ea19fd320 100644 --- a/sapi/embed/EXPERIMENTAL +++ b/sapi/embed/EXPERIMENTAL @@ -1,5 +1,5 @@ this module is experimental, -its functions may change their names -or move to extension all together -so do not rely to much on them +its functions may change their names +or move to extension all together +so do not rely to much on them you have been warned! diff --git a/sapi/fpm/Makefile.frag b/sapi/fpm/Makefile.frag index b4c08b4fa5..c6a290f9d5 100644 --- a/sapi/fpm/Makefile.frag +++ b/sapi/fpm/Makefile.frag @@ -18,7 +18,7 @@ install-fpm: $(SAPI_FPM_PATH) $(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf.default; \ $(INSTALL_DATA) sapi/fpm/www.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d/www.conf.default; \ fi - + @echo "Installing PHP FPM man page: $(INSTALL_ROOT)$(mandir)/man8/" @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man8 @$(INSTALL_DATA) sapi/fpm/php-fpm.8 $(INSTALL_ROOT)$(mandir)/man8/php-fpm$(program_suffix).8 diff --git a/sapi/fpm/php-fpm.8.in b/sapi/fpm/php-fpm.8.in index 4497e6e61c..86edaa894f 100644 --- a/sapi/fpm/php-fpm.8.in +++ b/sapi/fpm/php-fpm.8.in @@ -7,7 +7,7 @@ php-fpm \- PHP FastCGI Process Manager 'PHP-FPM' [options] .LP .SH DESCRIPTION -\fBPHP\fP is a widely\-used general\-purpose scripting language that is especially suited for +\fBPHP\fP is a widely\-used general\-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This is a variant of PHP that will run in the background as a daemon, listening for CGI requests. Output is logged to @php_fpm_localstatedir@/log/php-fpm.log. .LP Most options are set in the configuration file. The configuration file is @php_fpm_sysconfdir@/php-fpm.conf. By default, php-fpm will respond to CGI requests listening on localhost http port 9000. Therefore php-fpm expects your webserver to forward all requests for '.php' files to port 9000 and you should edit your webserver configuration file appropriately. @@ -21,8 +21,8 @@ Do not chdir to the script's directory .TP .PD 1 .B \-c \fIpath\fP|\fIfile\fP -Look for -.B php.ini +Look for +.B php.ini file in the directory .IR path or use the specified @@ -33,8 +33,8 @@ or use the specified .TP .PD 1 .B \-n -No -.B php.ini +No +.B php.ini file will be used .TP .PD 0 @@ -42,8 +42,8 @@ file will be used .TP .PD 1 .B \-d \fIfoo\fP[=\fIbar\fP] -Define INI entry -.IR foo +Define INI entry +.IR foo with value .IR bar .TP @@ -208,7 +208,7 @@ A List of active developers can be found here: .B http://www.php.net/credits.php .PD 1 .P -And last but not least PHP was developed with the help of a huge amount of +And last but not least PHP was developed with the help of a huge amount of contributors all around the world. .SH VERSION INFORMATION This manpage describes \fBphp-fpm\fP, version @PHP_VERSION@. diff --git a/sapi/fpm/status.html.in b/sapi/fpm/status.html.in index 7b5aedc425..863fcf3b54 100644 --- a/sapi/fpm/status.html.in +++ b/sapi/fpm/status.html.in @@ -5,9 +5,9 @@ The PHP License, version 3.01 This is sample real-time status page for FPM. You can change it to better fit your needs. --> - <head> + <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> - <style type="text/css"> + <style type="text/css"> body {background-color: #ffffff; color: #000000;} body, td, th, h1, h2 {font-family: sans-serif;} pre {margin: 0px; font-family: monospace;} @@ -32,40 +32,40 @@ } img {float: right; border: 0px;} hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;} - </style> + </style> <title>PHP-FPM status page</title> - <meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" /></head> + <meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" /></head> <body> <div class="center"> <table border="0" cellpadding="3" width="95%"> <tr class="h"> - <td> + <td> <a href="http://www.php.net/"><img border="0" src="https://static.php.net/www.php.net/images/php.gif" alt="PHP Logo" /></a><h1 class="p">PHP-FPM real-time status page</h1> </td> </tr> </table> <br /> <table border="0" cellpadding="3" width="95%"> - <tr><td class="e">Status URL</td><td class="v"><input type="text" id="url" size="45" /></td></tr> - <tr><td class="e">Ajax status</td><td class="v" id="status"></td></tr> - <tr><td class="e">Refresh Rate</td><td class="v"><input type="text" id="rate" value="1" /></td></tr> + <tr><td class="e">Status URL</td><td class="v"><input type="text" id="url" size="45" /></td></tr> + <tr><td class="e">Ajax status</td><td class="v" id="status"></td></tr> + <tr><td class="e">Refresh Rate</td><td class="v"><input type="text" id="rate" value="1" /></td></tr> <tr> <td class="e">Actions</td> <td class="v"> <button onclick="javascript:refresh();">Manual Refresh</button> <button id="play" onclick="javascript:playpause();">Play</button> </td> - </tr> + </tr> </table> - <h1>Pool Status</h1> + <h1>Pool Status</h1> <table border="0" cellpadding="3" width="95%" id="short"> <tr style="display: none;"><td> </td></tr> </table> - <h1>Active Processes status</h1> + <h1>Active Processes status</h1> <table border="0" cellpadding="3" width="95%" id="active"> <tr class="h"><th>PID↓</th><th>Start Time</th><th>Start Since</th><th>Requests Served</th><th>Request Duration</th><th>Request method</th><th>Request URI</th><th>Content Length</th><th>User</th><th>Script</th></tr> </table> - <h1>Idle Processes status</h1> + <h1>Idle Processes status</h1> <table border="0" cellpadding="3" width="95%" id="idle"> <tr class="h"><th>PID↓</th><th>Start Time</th><th>Start Since</th><th>Requests Served</th><th>Request Duration</th><th>Request method</th><th>Request URI</th><th>Content Length</th><th>User</th><th>Script</th><th>Last Request %CPU</th><th>Last Request Memory</th></tr> </table> diff --git a/sapi/fpm/tests/fcgi.inc b/sapi/fpm/tests/fcgi.inc index 71bdad17b9..07603a808e 100644 --- a/sapi/fpm/tests/fcgi.inc +++ b/sapi/fpm/tests/fcgi.inc @@ -603,7 +603,7 @@ class Client } if ($resp['type'] == self::END_REQUEST) { $this->_requests[$resp['requestId']]['state'] = self::REQ_STATE_OK; - if ($resp['requestId'] == $requestId) { + if ($resp['requestId'] == $requestId) { break; } } diff --git a/sapi/litespeed/README.md b/sapi/litespeed/README.md index 99967ce3d6..e744030de7 100644 --- a/sapi/litespeed/README.md +++ b/sapi/litespeed/README.md @@ -3,27 +3,27 @@ Introduction LiteSpeed SAPI module is a dedicated interface for PHP integration with LiteSpeed Web Server. LiteSpeed SAPI has similar architecture to the -FastCGI SAPI with there major enhancements: better performance, dynamic +FastCGI SAPI with there major enhancements: better performance, dynamic spawning and PHP configuration modification through web server -configuration and .htaccess files. +configuration and .htaccess files. Our simple benchmark test ("hello world") shows that PHP with LiteSpeed SAPI has 30% better performance over PHP with FastCGI SAPI, -which is nearly twice the performance that Apache mod_php can deliver. - +which is nearly twice the performance that Apache mod_php can deliver. + A major drawback of FastCGI PHP comparing to Apache mod_php is lacking -the flexibilities in PHP configurations. PHP configurations cannot be +the flexibilities in PHP configurations. PHP configurations cannot be changed at runtime via configuration files like .htaccess files or web -server's virtual host configuration. In shared hosting environment, -each hosting account will has its own "open_basedir" overridden in +server's virtual host configuration. In shared hosting environment, +each hosting account will has its own "open_basedir" overridden in server configuration to enhance server security when mod_php is used. -usually, FastCGI PHP is not an option in shared hosting environment +usually, FastCGI PHP is not an option in shared hosting environment due to lacking of this flexibility. LiteSpeed SAPI is carefully designed -to address this issue. PHP configurations can be modified the same way -as that in mod_php with the same configuration directives. +to address this issue. PHP configurations can be modified the same way +as that in mod_php with the same configuration directives. -PHP with LiteSpeed SAPI is highly recommended over FastCGI PHP for -PHP scripting with LiteSpeed web server. +PHP with LiteSpeed SAPI is highly recommended over FastCGI PHP for +PHP scripting with LiteSpeed web server. Building PHP with LiteSpeed SAPI @@ -31,9 +31,9 @@ Building PHP with LiteSpeed SAPI You need to add "--with-litespeed" to the configure command to build PHP with LiteSpeed SAPI, all other SAPI related configure options -should be removed. +should be removed. -For example: +For example: ./configure --with-litespeed make @@ -42,17 +42,17 @@ directory after the compilation succeeds. Copy it to 'lsws/fcgi-bin/lsphp' or wherever you prefer, if LiteSpeed web server has been configured to run PHP with LiteSpeed SAPI already, you just need to overwrite the old executable with this one and you are all -set. +set. Start PHP from command line =========================== Usually, lsphp is managed by LiteSpeed web server in a single server -installation. lsphp can be used in clustered environment with one -LiteSpeed web server at the front, load balancing lsphp processes +installation. lsphp can be used in clustered environment with one +LiteSpeed web server at the front, load balancing lsphp processes running on multiple backend servers. In such environment, lsphp can be -start manually from command with option "-b <socket_address>", socket -address can be IPv4, IPv6 or Unix Domain Socket address. +start manually from command with option "-b <socket_address>", socket +address can be IPv4, IPv6 or Unix Domain Socket address. for example: ./lsphp -b [::]:3000 @@ -76,56 +76,56 @@ Using LiteSpeed PHP with LiteSpeed Web Server ============================================= Detailed information about how to configure LiteSpeed web server with -PHP support is available from our website, at: +PHP support is available from our website, at: https://www.litespeedtech.com/docs/webserver Usually, PHP support has been configured out of box, you don't need to change it unless you want to change PHP interface from FastCGI to -LiteSpeed SAPI or vice versa. +LiteSpeed SAPI or vice versa. Brief instructions are as follow: 1) Login to web administration interface, go to 'Server'->'Ext App' tab, add an external application of type "LSAPI app", "Command" should be - set to a shell command that executes the PHP binary you just built. - "Instances" should be set to "1". Add "LSAPI_CHILDREN" environment - variable to match the value of "Max Connections". More tunable - environment variable described below can be added. + set to a shell command that executes the PHP binary you just built. + "Instances" should be set to "1". Add "LSAPI_CHILDREN" environment + variable to match the value of "Max Connections". More tunable + environment variable described below can be added. 2) Go to 'Server'->'Script Handler' tab, add a script handler configuration: set 'suffix' to 'php', 'Handler Type' to 'LiteSpeed API', 'Handler Name' should be the name of external application - just defined. + just defined. -3) Click 'Apply Changes' link on the top left of the page, then click - 'graceful restart'. Now PHP is running with LiteSpeed SAPI. +3) Click 'Apply Changes' link on the top left of the page, then click + 'graceful restart'. Now PHP is running with LiteSpeed SAPI. Tunings ------- There are a few environment variables that can be tweaked to control the -behavior of LSAPI application. +behavior of LSAPI application. * LSAPI_CHILDREN or PHP_LSAPI_CHILDREN (default: 0) -There are two ways to let PHP handle multiple requests concurrently, -Server Managed Mode and Self Managed Mode. In Server Managed Mode, +There are two ways to let PHP handle multiple requests concurrently, +Server Managed Mode and Self Managed Mode. In Server Managed Mode, LiteSpeed web server dynamically spawn/stop PHP processes, in this mode -"Instances" should match "Max Connections" configuration for PHP -external application. To start PHP in Self Managed Mode, "Instances" +"Instances" should match "Max Connections" configuration for PHP +external application. To start PHP in Self Managed Mode, "Instances" should be set to "1", while "LSAPI_CHILDREN" environment variable should -be set to match the value of "Max Connections" and >1. Web Server will -start one PHP process, this process will start/stop children PHP processes -dynamically based on on demand. If "LSAPI_CHILDREN" <=1, PHP will be +be set to match the value of "Max Connections" and >1. Web Server will +start one PHP process, this process will start/stop children PHP processes +dynamically based on on demand. If "LSAPI_CHILDREN" <=1, PHP will be started in server managed mode. -Self Managed Mode is preferred because all PHP processes can share one +Self Managed Mode is preferred because all PHP processes can share one shared memory block for the opcode cache. Usually, there is no need to set value of LSAPI_CHILDREN over 100 in -most server environment. +most server environment. * LSAPI_AVOID_FORK (default: 0) @@ -151,22 +151,22 @@ LSAPI_CHIDLREN, When LSAPI_AVOID_FORK is set to 1, the default value is 0. * LSAPI_MAX_REQS or PHP_LSAPI_MAX_REQUESTS (default value: 10000) This controls how many requests each child process will handle before -it exits automatically. Several PHP functions have been identified -having memory leaks. This parameter can help reducing memory usage -of leaky PHP functions. +it exits automatically. Several PHP functions have been identified +having memory leaks. This parameter can help reducing memory usage +of leaky PHP functions. * LSAPI_MAX_IDLE (default value: 300 seconds) -In Self Managed Mode, LSAPI_MAX_IDLE controls how long a idle child -process will wait for a new request before it exits. This option help +In Self Managed Mode, LSAPI_MAX_IDLE controls how long a idle child +process will wait for a new request before it exits. This option help releasing system resources taken by idle processes. * LSAPI_MAX_IDLE_CHILDREN (default value: 1/3 of LSAPI_CHILDREN or LSAPI_CHILDREN) -In Self Managed Mode, LSAI_MAX_IDLE_CHILDREN controls how many idle +In Self Managed Mode, LSAI_MAX_IDLE_CHILDREN controls how many idle children processes are allowed. Excessive idle children processes will be killed by the parent process immediately. When LSAPI_AVOID_FORK is set to 0, the default value is 1/3 of @@ -176,10 +176,10 @@ is LSAPI_CHILDREN. * LSAPI_MAX_PROCESS_TIME (default value: 300 seconds) -In Self Managed Mode, LSAPI_MAX_PROCESS_TIME controls the maximum +In Self Managed Mode, LSAPI_MAX_PROCESS_TIME controls the maximum processing time allowed when processing a request. If a child process -can not finish processing of a request in the given time period, it -will be killed by the parent process. This option can help getting rid +can not finish processing of a request in the given time period, it +will be killed by the parent process. This option can help getting rid of dead or runaway child process. @@ -187,26 +187,26 @@ of dead or runaway child process. In Self Managed Mode, LSAPI_PGRP_MAX_IDLE controls how long the parent process will wait before exiting when there is no child process. -This option help releasing system resources taken by an idle parent +This option help releasing system resources taken by an idle parent process. * LSAPI_PPID_NO_CHECK By default a LSAPI application check the existence of its parent process -and exits automatically if the parent process died. This is to reduce -orphan process when web server is restarted. However, it is desirable -to disable this feature, such as when a LSAPI process was started -manually from command line. LSAPI_PPID_NO_CHECK should be set when +and exits automatically if the parent process died. This is to reduce +orphan process when web server is restarted. However, it is desirable +to disable this feature, such as when a LSAPI process was started +manually from command line. LSAPI_PPID_NO_CHECK should be set when you want to disable the checking of existence of parent process. -When PHP started by "-b" option, it is disabled automatically. +When PHP started by "-b" option, it is disabled automatically. Compatibility with Apache mod_php ================================= -LSAPI PHP supports PHP configuration overridden via web server configuration -as well as .htaccess. +LSAPI PHP supports PHP configuration overridden via web server configuration +as well as .htaccess. Since 4.0 release "apache_response_headers" function is supported. diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index c4ed6bb4d6..685892e708 100644 --- a/sapi/litespeed/lsapilib.c +++ b/sapi/litespeed/lsapilib.c @@ -153,7 +153,7 @@ static int s_max_busy_workers = -1; static char *s_stderr_log_path = NULL; static int s_ignore_pid = -1; -LSAPI_Request g_req = +LSAPI_Request g_req = { .m_fdListen = -1, .m_fd = -1 }; static char s_secret[24]; @@ -216,7 +216,7 @@ static int HTTP_HEADER_LEN[H_TRANSFER_ENCODING+1] = }; -static const char *s_log_level_names[8] = +static const char *s_log_level_names[8] = { "", "DEBUG","INFO", "NOTICE", "WARN", "ERROR", "CRIT", "FATAL" }; @@ -229,7 +229,7 @@ void LSAPI_Log(int flag, const char * fmt, ...) if (flag & LSAPI_LOG_TIMESTAMP_BITS) { struct timeval tv; - struct tm tm; + struct tm tm; gettimeofday(&tv, NULL); localtime_r(&tv.tv_sec, &tm); if (flag & LSAPI_LOG_TIMESTAMP_FULL) @@ -244,20 +244,20 @@ void LSAPI_Log(int flag, const char * fmt, ...) tm.tm_hour, tm.tm_min, tm.tm_sec); } } - + int level = flag & LSAPI_LOG_LEVEL_BITS; if (level && level <= LSAPI_LOG_FLAG_FATAL) { p += snprintf(p, 100, "[%s] ", s_log_level_names[level]); } - + if (flag & LSAPI_LOG_PID) { p += snprintf(p, 100, "[%d] ", s_pid); } - + if (p > buf) - fprintf(stderr, "%.*s", (int)(p - buf), buf); + fprintf(stderr, "%.*s", (int)(p - buf), buf); va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); @@ -276,7 +276,7 @@ void LSAPI_Log(int flag, const char * fmt, ...) #endif -static int lsapi_parent_dead() +static int lsapi_parent_dead() { // Return non-zero if the parent is dead. 0 if still alive. if (!s_ppid) { @@ -409,7 +409,7 @@ static void lsapi_close_connection(LSAPI_Request *pReq) __sync_fetch_and_sub(s_busy_workers, 1); if (s_worker_status) s_worker_status->m_connected = 0; -} +} static inline ssize_t lsapi_read( int fd, void * pBuf, size_t len ) @@ -868,7 +868,7 @@ int LSAPI_is_suEXEC_Daemon(void) static int LSAPI_perror_r( LSAPI_Request * pReq, const char * pErr1, const char *pErr2 ) { char achError[4096]; - int n = snprintf(achError, sizeof(achError), "[%d] %s:%s: %s\n", getpid(), + int n = snprintf(achError, sizeof(achError), "[%d] %s:%s: %s\n", getpid(), pErr1, (pErr2)?pErr2:"", strerror(errno)); if (n > (int)sizeof(achError)) n = sizeof(achError); @@ -1258,7 +1258,7 @@ static struct lsapi_packet_header s_ack = {'L', 'S', LSAPI_REQ_RECEIVED, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} }; static struct lsapi_packet_header s_conn_close_pkt = {'L', 'S', LSAPI_CONN_CLOSE, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} }; - + static inline int send_notification_pkt( int fd, struct lsapi_packet_header *pkt ) { @@ -1575,7 +1575,7 @@ int LSAPI_Accept_r( LSAPI_Request * pReq ) static struct lsapi_packet_header finish = {'L', 'S', LSAPI_RESP_END, LSAPI_ENDIAN, {LSAPI_PACKET_HEADER_LEN} }; - + int LSAPI_Finish_r( LSAPI_Request * pReq ) { /* finish req body */ @@ -2792,7 +2792,7 @@ static void lsapi_sigchild( int signal ) { int status, pid; lsapi_child_status * child_status; - if (g_prefork_server == NULL) + if (g_prefork_server == NULL) return; while( 1 ) { @@ -2842,9 +2842,9 @@ static void lsapi_sigchild( int signal ) static int lsapi_init_children_status(void) { int size = 4096; - int max_children = g_prefork_server->m_iMaxChildren + int max_children = g_prefork_server->m_iMaxChildren + g_prefork_server->m_iExtraChildren; - + char * pBuf; size = max_children * sizeof( lsapi_child_status ) * 2 + 3 * sizeof(int); size = (size + 4095) / 4096 * 4096; @@ -2878,11 +2878,11 @@ static void dump_debug_info( lsapi_child_status * pStatus, long tmCur ) fprintf( stderr, "[%s] Possible runaway process, PPID: %d, PID: %d, " "reqCount: %d, process time: %ld, checkpoint time: %ld, start " - "time: %ld\n", ctime(&tmCur), getpid(), pStatus->m_pid, - pStatus->m_iReqCounter, tmCur - pStatus->m_tmReqBegin, + "time: %ld\n", ctime(&tmCur), getpid(), pStatus->m_pid, + pStatus->m_iReqCounter, tmCur - pStatus->m_tmReqBegin, tmCur - pStatus->m_tmLastCheckPoint, tmCur - pStatus->m_tmStart ); snprintf( achCmd, 1024, "gdb --batch -ex \"attach %d\" -ex \"set height 0\" " - "-ex \"bt\" >&2;PATH=$PATH:/usr/sbin lsof -p %d >&2", + "-ex \"bt\" >&2;PATH=$PATH:/usr/sbin lsof -p %d >&2", pStatus->m_pid, pStatus->m_pid ); if ( system( achCmd ) == -1 ) perror( "system()" ); @@ -2907,8 +2907,8 @@ static void lsapi_check_child_status( long tmCur ) if ( !pStatus->m_inProcess ) { - if (g_prefork_server->m_iCurChildren - dying - > g_prefork_server->m_iMaxChildren + if (g_prefork_server->m_iCurChildren - dying + > g_prefork_server->m_iMaxChildren || idle > g_prefork_server->m_iMaxIdleChildren) { ++pStatus->m_iKillSent; @@ -2916,7 +2916,7 @@ static void lsapi_check_child_status( long tmCur ) } else { - if (s_max_idle_secs> 0 + if (s_max_idle_secs> 0 && tmCur - pStatus->m_tmWaitBegin > s_max_idle_secs + 5) { ++pStatus->m_iKillSent; @@ -2949,7 +2949,7 @@ static void lsapi_check_child_status( long tmCur ) } if ( tobekilled ) { - if (( kill( pStatus->m_pid, tobekilled ) == -1 ) && + if (( kill( pStatus->m_pid, tobekilled ) == -1 ) && ( errno == ESRCH )) { pStatus->m_pid = 0; @@ -2967,7 +2967,7 @@ static void lsapi_check_child_status( long tmCur ) if ( abs( g_prefork_server->m_iCurChildren - count ) > 1 ) { fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Children: %d," - " count: %d, idle: %d, dying: %d\n", getpid(), + " count: %d, idle: %d, dying: %d\n", getpid(), g_prefork_server->m_iCurChildren, count, idle, dying ); } } @@ -2993,7 +2993,7 @@ static void lsapi_check_child_status( long tmCur ) //} -static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, +static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Request * pReq ) { struct sigaction act, old_term, old_quit, old_int, @@ -3062,13 +3062,13 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, FD_ZERO( &readfds ); FD_SET( pServer->m_fd, &readfds ); - timeout.tv_sec = 1; + timeout.tv_sec = 1; timeout.tv_usec = 0; ret = (*g_fnSelect)(pServer->m_fd+1, &readfds, NULL, NULL, &timeout); if (ret == 1 ) { - if (pServer->m_iCurChildren >= pServer->m_iMaxChildren - && s_accepting_workers + if (pServer->m_iCurChildren >= pServer->m_iMaxChildren + && s_accepting_workers && (ret = __sync_add_and_fetch(s_accepting_workers, 0)) > 0) { usleep( 200 ); @@ -3087,13 +3087,13 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, continue; } - if (pServer->m_iCurChildren >= + if (pServer->m_iCurChildren >= pServer->m_iMaxChildren + pServer->m_iExtraChildren) { fprintf( stderr, "Reached max children process limit: %d, extra: %d," " current: %d, busy: %d, please increase LSAPI_CHILDREN.\n", - pServer->m_iMaxChildren, pServer->m_iExtraChildren, - pServer->m_iCurChildren, + pServer->m_iMaxChildren, pServer->m_iExtraChildren, + pServer->m_iCurChildren, s_busy_workers ? *s_busy_workers : -1 ); usleep( 100000 ); continue; @@ -3192,7 +3192,7 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, void lsapi_error( const char * pMessage, int err_no ) { - fprintf( stderr, "%d: %s, errno: %d (%s)\n", getpid(), pMessage, err_no, + fprintf( stderr, "%d: %s, errno: %d (%s)\n", getpid(), pMessage, err_no, strerror( err_no ) ); } @@ -3222,7 +3222,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) lsapi_close_connection(pReq); } } - + if ( (unsigned int)s_req_processed > s_max_reqs ) return -1; @@ -3249,7 +3249,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) { if ( !g_running ) return -1; - if (s_req_processed && s_worker_status + if (s_req_processed && s_worker_status && s_worker_status->m_iKillSent) return -1; FD_ZERO( &readfds ); @@ -3267,7 +3267,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) if (s_accepting_workers) __sync_fetch_and_sub(s_accepting_workers, 1); } - + if ( ret == 0 ) { if ( s_worker_status ) @@ -3291,7 +3291,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) } else if ( ret >= 1 ) { - if (s_req_processed && s_worker_status + if (s_req_processed && s_worker_status && s_worker_status->m_iKillSent) return -1; if ( fd == pReq->m_fdListen ) @@ -3305,7 +3305,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) __sync_fetch_and_add(s_busy_workers, 1); fd = pReq->m_fd; - + lsapi_set_nblock( fd, 0 ); //init_conn_key( pReq->m_fd ); if ( !s_keepListener ) @@ -3337,7 +3337,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) s_worker_status->m_iKillSent = 0; s_worker_status->m_inProcess = 1; ++s_worker_status->m_iReqCounter; - s_worker_status->m_tmReqBegin = + s_worker_status->m_tmReqBegin = s_worker_status->m_tmLastCheckPoint = time(NULL); } ++s_req_processed; @@ -3411,7 +3411,7 @@ void LSAPI_No_Check_ppid(void) } -int LSAPI_Get_ppid() +int LSAPI_Get_ppid() { return(s_ppid); } @@ -3521,7 +3521,7 @@ static int lsapi_check_path(const char *p, char *final, int max_len) return -1; } p = final; - if (realpath(p, resolved_path) == NULL + if (realpath(p, resolved_path) == NULL && errno != ENOENT && errno != EACCES) return -1; if (strncmp(resolved_path, "/etc/", 5) == 0) @@ -3576,13 +3576,13 @@ int LSAPI_Init_Env_Parameters( fn_select_t fp ) const char *p; int n; int avoidFork = 0; - + p = getenv("LSAPI_STDERR_LOG"); if (p) { lsapi_reopen_stderr(p); } - + p = getenv( "PHP_LSAPI_MAX_REQUESTS" ); if ( !p ) p = getenv( "LSAPI_MAX_REQS" ); @@ -3675,7 +3675,7 @@ int LSAPI_Init_Env_Parameters( fn_select_t fp ) { LSAPI_No_Check_ppid(); } - + p = getenv("LSAPI_MAX_BUSY_WORKER"); if (p) { @@ -3684,7 +3684,7 @@ int LSAPI_Init_Env_Parameters( fn_select_t fp ) if (n >= 0) LSAPI_No_Check_ppid(); } - + p = getenv( "LSAPI_DUMP_DEBUG_INFO" ); if ( p ) @@ -3950,7 +3950,7 @@ static void lsapi_MD5Transform(uint32 buf[4], uint32 const in[16]) } -int LSAPI_Set_Restored_Parent_Pid(int pid) +int LSAPI_Set_Restored_Parent_Pid(int pid) { int old_ppid = s_ppid; s_restored_ppid = pid; diff --git a/sapi/litespeed/lscriu.h b/sapi/litespeed/lscriu.h index 9f40df37d5..cc0186ef79 100644 --- a/sapi/litespeed/lscriu.h +++ b/sapi/litespeed/lscriu.h @@ -21,18 +21,18 @@ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are -met: +met: * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided - with the distribution. + with the distribution. * Neither the name of the Lite Speed Technologies Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior - written permission. + written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -44,7 +44,7 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LSCRIU_H_ diff --git a/sapi/phpdbg/.phpdbginit b/sapi/phpdbg/.phpdbginit index 1ad35218ed..7ee34fccaa 100644 --- a/sapi/phpdbg/.phpdbginit +++ b/sapi/phpdbg/.phpdbginit @@ -25,7 +25,7 @@ */ /* -function my_debugging_function() +function my_debugging_function() { var_dump(func_get_args()); } @@ -49,31 +49,31 @@ if (function_exists('readline_completion_function')) { /* Setting argv made trivial ... - + argv 1 2 3 4 ^ set argv for next execution - + argv ^ unset argv for next execution - + */ function argv() { $argv = func_get_args(); - + if (!$argv) { $_SERVER['argv'] = array(); $_SERVER['argc'] = 0; return; } - + $_SERVER['argv'] = array_merge ( array("phpdbg"), $argv - ); + ); $_SERVER['argc'] = count($_SERVER['argv']); - + return $_SERVER['argv']; } :> diff --git a/sapi/phpdbg/phpdbg.init.d b/sapi/phpdbg/phpdbg.init.d index 99a1ab328b..1f0b1fdbf9 100755 --- a/sapi/phpdbg/phpdbg.init.d +++ b/sapi/phpdbg/phpdbg.init.d @@ -44,7 +44,7 @@ insanity() return 1 fi fi - + return 0 } diff --git a/sapi/phpdbg/web-bootstrap.php b/sapi/phpdbg/web-bootstrap.php index 7b8c5d30de..046062997e 100644 --- a/sapi/phpdbg/web-bootstrap.php +++ b/sapi/phpdbg/web-bootstrap.php @@ -1,26 +1,26 @@ <?php /** * The following file shows how to bootstrap phpdbg so that you can mock specific server environments - * + * * eval include("web-bootstrap.php") * exec index.php * compile * break ... * run */ -if (!defined('PHPDBG_BOOTSTRAPPED')) +if (!defined('PHPDBG_BOOTSTRAPPED')) { /* define these once */ define("PHPDBG_BOOTPATH", "/opt/php-zts/htdocs"); define("PHPDBG_BOOTSTRAP", "index.php"); - define("PHPDBG_BOOTSTRAPPED", sprintf("/%s", PHPDBG_BOOTSTRAP)); + define("PHPDBG_BOOTSTRAPPED", sprintf("/%s", PHPDBG_BOOTSTRAP)); } /* * Superglobals are JIT, phpdbg will not over-write whatever you set during bootstrap */ -$_SERVER = array +$_SERVER = array ( 'HTTP_HOST' => 'localhost', 'HTTP_CONNECTION' => 'keep-alive', diff --git a/sapi/phpdbg/xml.md b/sapi/phpdbg/xml.md index 56dcaaa1f7..c02f80f2ca 100644 --- a/sapi/phpdbg/xml.md +++ b/sapi/phpdbg/xml.md @@ -297,7 +297,7 @@ info (subcommands) - <classinfo num="" /> with num having an integer value, indicating the number of loaded user-defined classes - Each class is enumerated with first a <class>, then an optional <parents> container and then a <classsource> element -- The <parents> container contains the <class> elements of the parent of the last <class> element. +- The <parents> container contains the <class> elements of the parent of the last <class> element. - <class type="" flags="" name="" methodcount="" /> - type: either "User" or "Internal" - flags: either "Interface", "Class" or "Abstract Class" |