adoy / php-fastcgi-client Goto Github PK
View Code? Open in Web Editor NEWLightweight, single file, FastCGI client for PHP
License: MIT License
Lightweight, single file, FastCGI client for PHP
License: MIT License
Curly brace syntax for accessing array elements and string offsets is deprecated in PHP 7.4.
This piece of code should be changed according to new rules:
while ($p != $length) {
$nlen = ord(
$data {
$p++
}
);
if ($nlen >= 128) {
$nlen = ($nlen & 0x7F << 24);
$nlen |= (ord(
$data {
$p++
}
) << 16);
$nlen |= (ord(
$data {
$p++
}
) << 8);
$nlen |= (ord(
$data {
$p++
}
));
}
$vlen = ord(
$data {
$p++
}
);
if ($vlen >= 128) {
$vlen = ($nlen & 0x7F << 24);
$vlen |= (ord(
$data {
$p++
}
) << 16);
$vlen |= (ord(
$data {
$p++
}
) << 8);
$vlen |= (ord(
$data {
$p++
}
));
}
$array[substr($data, $p, $nlen)] = substr($data, $p + $nlen, $vlen);
$p += ($nlen + $vlen);
}
The current implementation is using a blocking socket stream implementation.
Would you accept a non-blocking implementation in your project?
Do you have any criteria that I should meet for my contribution to be accepted?
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/local/openresty/nginx/html/php/src/Adoy/FastCGI/Client.php on line 267
Warning: fsockopen(): unable to connect to unix:/var/run/php/php7.4-fpm.sock:-1 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /usr/local/openresty/nginx/html/php/src/Adoy/FastCGI/Client.php on line 267
Fatal error: Uncaught Exception: Unable to connect to FastCGI application: php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/local/openresty/nginx/html/php/src/Adoy/FastCGI/Client.php:271 Stack trace: #0 /usr/local/openresty/nginx/html/php/src/Adoy/FastCGI/Client.php(474): Adoy\FastCGI\Client->connect() #1 /usr/local/openresty/nginx/html/php/src/Adoy/FastCGI/Client.php(451): Adoy\FastCGI\Client->async_request() #2 /usr/local/openresty/nginx/html/php/test.php(13): Adoy\FastCGI\Client->request() #3 {main} thrown in /usr/local/openresty/nginx/html/php/src/Adoy/FastCGI/Client.php on line 271
I noticed ForbiddenException('Not in white list. Check listen.allowed_clients.') is thrown when a zero-byte response is received from the closing socket.
Apparently this is what happens when php-fpm encounters a client that is not allowed to connect. This is one of many cases however. Network disruption could cause this too, a restarting php-fpm server will cause this too.
I would suggest a more generic exception name for this.
Can you let us know the example of "async_request" model?
I've read the readPacket private function and found the implementation way to naive to be used in production systems.
When $packet = fread($this->_sock, self::HEADER_LEN)
is called on line 382 the returned value is considered to be either false or a 8 byte string. In reality this string can have any length up to 8 bytes.
This problem does not occur when reading the content, because reading won't stop until $resp['contentLength']
bytes are read, but the fread($this->_sock, $resp['paddingLength'])
call suffers from the same problem.
Could you guys tag a version for packagist.
I'm using this library in cachetool and it sucks that i have to set the minimum-stability
to dev
I want to create a file upload using FastCGI Client, it seems that it only supports STDIN as normal POST?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.