deemru / php-cgi-spawner

Spawns php-cgi processes
MIT License
154 stars 29 forks source link

Where can I view errors encountered in the `php-cgi-spawner.exe`? #11

Open Qsppl opened 2 weeks ago

Qsppl commented 2 weeks ago

When processing a large number of requests, somewhere between NGinx and a PHP application, I get an error that I cannot find.

The NGinx access log simply says "upstream_status is 502":

{
    "time_iso8601": "2024-11-07T18:01:35+03:00",
    "time_local": "07/Nov/2024:18:01:35 +0300",
    "remote_addr": "127.0.0.1",
    "remote_port": "64432",
    "remote_user": "",
    "server_protocol": "HTTP/2.0",
    "bytes_sent": 754,
    "status": 502,
    "http_x_request_id": "",
    "http_accept": "*/*",
    "http_accept_encoding": "gzip, deflate, br, zstd",
    "http_traceparent": "",
    "http_tracestate": "",
    "request_method": "GET",
    "request_uri": "/ymap/investment_subjects_browser/geo-object-of-project/get-collection-by-area-as-jsonp?bounds=50.9248,30.9375,52.6684,33.7500&callback=id_173099169289773033535",
    "request_length": 146,
    "request_time": 2.022,
    "sent_http_content_length": "552",
    "sent_http_content_type": "text/html",
    "upstream_addr": "127.127.126.60:9000",
    "upstream_response_length": "0",
    "upstream_response_time": "2.022",
    "upstream_status": "502"
}

If you look at what is located at the "upstream_adress" specified in the log, then there is a spawner:

Proto  Local Address          Foreign Address        State
TCP    127.127.126.60:9000    0.0.0.0:0              LISTENING
[php-cgi-spawner.exe]

The target php file was not launched (there is logging on the first line, I would have seen it).

I think that the error occurred in the spawner, but I can’t find if this application has logging and how to configure it.

deemru commented 2 weeks ago

How do you run php-cgi-spawner?

I use this for ages with no errors:

set PHP_FCGI_MAX_REQUESTS=0
php-cgi-spawner.exe "php\php-cgi.exe -c php.ini" 9001 4 128

Over all these years php-cgi itself has managed to embed its own internal spawner, maybe you do not need to use php-cgi-spawner at all and use php-cgi for example like this:

set PHP_FCGI_MAX_REQUESTS=0
set PHP_FCGI_CHILDREN=4
cd php
start php-cgi.exe -c php.ini -b 9001
deemru commented 2 weeks ago

Also, regarding your question:

Where can I view errors encountered in the php-cgi-spawner.exe?

There is no error log for php-cgi-spawner as it only performs very basic tasks.

Qsppl commented 6 days ago

I'm using OSPanel.

OSPanel uses php-cgi-spawner to launch php.

I did not change the settings defined by the OSPanel developers.

I'm guessing that the OSPanel developers are running php-cgi-spawner incorrectly.

I will contact them with the same question.