Closed CatAnonymous closed 4 years ago
<?php
require 'src/Adoy/FastCGI/Client.php';
use Adoy\FastCGI\Client;
// Existing socket, such as Lighttpd with mod_fastcgi:
$client = new Client('unix:/var/run/php/php7.4-fpm.sock', -1);
$content = 'key=value';
echo $client->request(
array(
'GATEWAY_INTERFACE' => 'FastCGI/1.0',
'REQUEST_METHOD' => 'POST',
'SCRIPT_FILENAME' => '/usr/local/nginx/html/info.php',
'SERVER_SOFTWARE' => 'php/fcgiclient',
'REMOTE_ADDR' => '127.0.0.1',
'REMOTE_PORT' => '9985',
'SERVER_ADDR' => '127.0.0.1',
'SERVER_PORT' => '80',
'SERVER_NAME' => 'mag-tured',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
'CONTENT_LENGTH' => strlen($content)
),
$content
);
Can u convert fsockopen to cURL?
I'm not sure what you mean by replacing fsockopen by cURL ?
Your script is trying to connect via TCP instead of using a unix socket. You should use 'unix:///var/run/php/php7.4-fpm.sock'
and not 'unix:/var/run/php/php7.4-fpm.sock'
I'm not sure what you mean by replacing fsockopen by cURL ? Your script is trying to connect via TCP instead of using a unix socket. You should use
'unix:///var/run/php/php7.4-fpm.sock'
and not'unix:/var/run/php/php7.4-fpm.sock'
It works, thanks the author
I'm not sure what you mean by replacing fsockopen by cURL ? Your script is trying to connect via TCP instead of using a unix socket. You should use
'unix:///var/run/php/php7.4-fpm.sock'
and not'unix:/var/run/php/php7.4-fpm.sock'
Can I separate body and headers?
I see a similar and this is how they Parse header body and error
https://raw.githubusercontent.com/hollodotme/fast-cgi-client/master/src/Responses/Response.php
You have to do it on your own. The current state of the lib is not doing it.
You have to do it on your own. The current state of the lib is not doing it.
I see self::STDERR content (type=7) Can you detach it from the response? The best thing is that you can do it directly into this lib
array(
'states' => 0,
'response' => '',
'error' => ''
)
It is a php FPM error message, not a response content