X
X
xfg2015-05-29 11:24:43
PHP
xfg, 2015-05-29 11:24:43

How to make php-cgi work via php-fpm?

Hello. I execute the following code in the console

env ENV_1=VALUE_1 ENV_2=VALUE_2 ENV_N=VALUE_N php-cgi -f /home/user/www/test/info.php > phpinfo

FILE /home/user/www/test/info.php
<?php
phpinfo();
?>

As a result, if I open the generated phpinfo file, then the ServerAPI line says CGI/FastCGI, but I need everything to work through php-fpm. For example, if this file is executed through nginx, then ServerAPI will be equal to FPM/FastCGI
. How can I achieve the same result by executing scripts from the console? I need this to write my own small webserver. Thank you.
Update: Solution https://rtcamp.com/tutorials/php/directly-connect-...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2015-05-29
@xfg

no way. you can communicate with it over the network/socket using FastCGI.
PS the command above can be shortened tophp-cgi -i > phpinfo

N
Nurlan, 2015-05-29
@daager

Not?
Use cli and you will be happy.
PS For CLI your config.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question