PHP-DWS is the abbreviation for “PHP Direct Web Server”. It works much
like fastcgi server with nginx,
But nginx pass the request header of HTTP and socket file description of
this connection to it via
calling sendmsg(), and then PHP-dws read request body data from http
connection , send response
data to the http connection directly.
I simply draw their work in the following flow diagramï¼š
[PHP-CGI] ============ i)request header+body ii)request header+body +~~~~>~~~~>~~~~>~~~+ +~~~~~>~~~~~>~~~~>~~~~~+ | | | | /|\ \|/ / \ \|/ WebVisitor Web Server FastCGIServer (user) (nginx) (php-cgi) /|\ \ / /|\ \ / | | | | +~~~<~~~~<~~~~<~~~~+ +~~~~~<~~~~~<~~~~<~~~~~+ iv)response header+body iii)response header+body [PHP-DWS] ============ i)request header ii)request header +~~~~>~~~~>~~~~>~~~+ +~~~~~>~~~~~>~~~~>~~~~~+ | | | | /|\ \|/ / \ \|/ WebVisitor Web Server DWSCGI Server (user) (nginx) (php-dws) /|\ \ / /|\ \ / | | | | | +~~~~~~~~>~~~~~~~~~~~~>~~~~~~~~~~~~>~~~~~~~~+ | | iii) request body | | | +~~~~~~~~~~~~~<~~~~~~~~~~~<~~~~~~~~~~~~~<~~~~~~~~~~~~~~+ iv)response header+body
I think that php-dws will save much more IO operator and become more
In addition, we can send partial data to browser during script running,
Welcome to give me some suggestions or comments!
I have completed the preliminary work, including two part.
The first is ngx_http_dwsgi_module, download source codes from:
Extract it to top source directory of nginx, it will be looked like:
then recompile the nginx with option: --add-module=src/addon/dwsgi
config sample can be found in src/addon/dwsgi/*.conf
The second is a new sapi module for php, develop under 5.3.3, get the
code package from:
Extract it to top source directory of php5, it will be looked like:
then run following commands to rebuild the php:
./config.nice --disable-fpm --disable-cgi --enable-dws
make && make install
Run $prefix/bin/php-dwsctl to start or stop php-dws,
or try $prefix/bin/php-dws -h for more options and its description.