Nginx errors FastCGI sent in stderr: "PHP message: PHP Warning: Error while sending QUERY packet. PID=27384

Posted November 28, 2018 9.8k views
NginxUbuntu 18.04

I have been getting lots of errors in my Nginx error.log and most of them are *“FastCGI sent in stderr: "PHP message: PHP Warning: Error while sending QUERY packet. PID=” * .

When the error occurs I am unable to access any post. The post will generate “Error establishing database connection”. I am sure the two errors are related but how are they related and what is causing them I am unable to find it.

I have been tinkering with the MYSQL and Nginx settings but this error will not go away. Any help will be appreciated.

Here are my MYSQL settings:

key_buffer_size = 16M
max_allowed_packet = 512M
thread_stack = 192K
thread_cache_size = 152
innodb_buffer_pool_size = 5G
innodb_log_file_size = 640M
max_connections =150

And here is my NGINX setting;

worker_processes auto;
use epoll;
worker_connections 2000;
multi_accept on;
keepalive_timeout 20;

Here are my php-fpm settings

pm = ondemand
pm.max_children = 200
pm.process_idle_timeout = 10s;
pm.max_requests = 500

If any more information is needed to decode the error please reply. Thank you in advance.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Is the error_log enabled in PHP? If not, enable it and look at the what the log file says. It should have more reporting there.