Code Monkey home page Code Monkey logo

php-fastcgi-client's People

Contributors

adoy avatar dugwood avatar i-peppa avatar igorw avatar remicollet avatar timandes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-fastcgi-client's Issues

Broken pipe

hi
i use unix socket as below :

    $client = new \framework\FCGIClient('unix:///usr/local/php70/sockets/webapps.sock', -1);

but i get this error :

socket_write(): unable to write to socket [32]: Broken pipe 

my socket exist
image

Support PHP 7.4

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);
        }

non-blocking implementation

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?

Error


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

ForbiddenException

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.

fread() implementation

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.