Skip to content

Tanswer/FastCGI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

C language through FastCGI protocol, through php-fpm, php file parsed into html files.

How to use

Preparation:

please make sure you have installed php-fpm.

Testing environment:CentOS 7

configuration file:/usr/local/php/etc/php-fpm.conf

php file:my own user home directory ---/home/Tanswer/index.php

If you want to run, you need to change the php file path of main.c.

  1. Modify the configuration

    After the installation is complete, the default communication method for unix local domain socket communication, our example and php-fpm for TCP communication, so we should change the configuration, the ip address is set to 127.0.0.1, listening port 9000. As follows:

    enter image description here

  2. restart php-fpm

    sudo service php-fpm restart

  3. compiling and running

    git clone [email protected]:Tanswer/FastCGI.git
    cd FastCGI && make
    ./main
    

    found an error after running: error:Unable to open primary script: /home/Tanswer/index.php (No such file or directory)

    This is the issue of permissions, the permissions of index.php are: -rw-r--r-- 1 Tanswer Tanswer 64 12月 23 13:16 index.php. From the above default configuration file can be seen, the account that started the php-fpm process is www, and here we change it to Tanswer,as follows:

    enter image description here

    run again ./main, the result is as follows:

    enter image description here

Reference material

About

通过 FastCGI 协议,与 php-fpm 交互,将 php 解析,从而使 .php 文件被翻译为 .html 文件

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors