Comments (8)
<?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
);
from php-fastcgi-client.
Can u convert fsockopen to cURL?
from php-fastcgi-client.
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'
from php-fastcgi-client.
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
from php-fastcgi-client.
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?
from php-fastcgi-client.
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
from php-fastcgi-client.
You have to do it on your own. The current state of the lib is not doing it.
from php-fastcgi-client.
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
from php-fastcgi-client.
Related Issues (10)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-fastcgi-client.