1. Go to this page and download the library: Download lisachenko/protocol-fcgi library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lisachenko / protocol-fcgi example snippets
use Lisachenko\Protocol\FCGI;
use Lisachenko\Protocol\FCGI\FrameParser;
use Lisachenko\Protocol\FCGI\Record;
use Lisachenko\Protocol\FCGI\Record\BeginRequest;
use Lisachenko\Protocol\FCGI\Record\Params;
use Lisachenko\Protocol\FCGI\Record\Stdin;
arams(['SCRIPT_FILENAME' => '/var/www/some_file.php']);
$packet .= new Params();
$packet .= new Stdin();
fwrite($phpSocket, $packet);
$response = '';
while ($partialData = fread($phpSocket, 4096)) {
$response .= $partialData;
while (FrameParser::hasFrame($response)) {
$record = FrameParser::parseFrame($response);
var_dump($record);
};
};
fclose($phpSocket);
use Lisachenko\Protocol\FCGI;
use Lisachenko\Protocol\FCGI\FrameParser;
use Lisachenko\Protocol\FCGI\Record;
use Lisachenko\Protocol\FCGI\Record\BeginRequest;
use Lisachenko\Protocol\FCGI\Record\Params;
use Lisachenko\Protocol\FCGI\Record\Stdin;
$response .= $partialData;
while (FrameParser::hasFrame($response)) {
$record = FrameParser::parseFrame($response);
var_dump($record);
};
};
// We don't respond correctly here, it's a task for your application
fclose($phpSocket);
fclose($server);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.