aiddroid/fastcgi-php

此软件包最新版本(dev-master)的许可信息不可用。

使用PHP语言编写的FastCGI服务器和客户端。

dev-master 2019-11-14 11:21 UTC

This package is auto-updated.

Last update: 2024-09-14 22:26:45 UTC


README

使用PHP语言编写的FastCGI服务器和客户端[待办事项]。

如何使用它?

在nginx.conf中设置你的nginx配置,将请求传递到FastCGI端口1234并重新加载nginx

    server {
        listen       8080 default_server;
        server_name  localhost _;
        server_name_in_redirect off;
        root   html;
        index  index.php index.html index.htm;
        
        location /fastcgi {
            fastcgi_pass 127.0.0.1:1234;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }

下载FastCGI-php并运行一个FastCGI服务器

git clone https://github.com/aiddroid/FastCGI-php.git
cd FastCGI-php
composer install --dev
php tests/workerman-tcp-server.php start
# OR # php tests/php-tcp-server.php

现在,您将在下面看到一些信息

Workerman[tests/workerman-tcp-server.php] start in DEBUG mode
----------------------------------------- WORKERMAN -----------------------------------------
Workerman version:3.5.22          PHP version:7.3.11
------------------------------------------ WORKERS ------------------------------------------
proto   user            worker          listen                 processes    status
tcp     allen           none            fCGI://0.0.0.0:1234    1             [OK]
---------------------------------------------------------------------------------------------
Press Ctrl+C to stop. Start success.

使用curl测试FastCGI服务器

curl -i "https://:8080/fastcgi?uid=1" --data 'username=allen'

您将看到响应

HTTP/1.1 200 OK
Server: nginx/1.15.0
Date: Wed, 13 Nov 2019 03:33:52 GMT
Content-Type: text/raw
Transfer-Encoding: chunked
Connection: keep-alive

hello

作者

许可

本项目采用MIT许可证 - 对于完整的版权和许可信息,请查看与源代码一起分发的LICENSE文件。

版权(2019)版权所有。