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

November 28, 2018 3.4k views
Nginx Ubuntu 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
interactive_timeout=50
wait_timeout=40
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.

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.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!