Internal server error 500 crashes server laravel - php

Every time there is 500 error server cpu gets 100% and crashes needs to restart every time
PHP Version 7.4
Laravel Version 8.83
Ubuntu Ngnix
I found this in php7.4-fpm.log error logs
[13-Sep-2022 08:13:16] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
[13-Sep-2022 08:19:05] NOTICE: Terminating ...
[13-Sep-2022 08:19:05] NOTICE: exiting, bye-bye!
error.log
2022/09/13 10:52:53 [error] 889#889: *3130 upstream timed out (110: Connection timed out) while reading response header from upstream
2022/09/13 11:09:41 [crit] 889#889: *148 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking
Does anyone know about this?

Your PHP-FPM config is set to the default 5 children (simultaneously executing PHP requests) and that limit is (on occasion it appears) being exceeded and hence the 500 error. Have a read of this article if you want background knowledge on the PHP-FPM max_children setting.
There is also a handy online calculator for calculating a more appropriate max_children value for your server configuration.
Once you have calculated a new (higher) value for the setting, you'll need to update your PHP-FPM configuration and reset the PHP-FPM service on your server for the change to take effect.

Related

"Quota exceeded (122)" error on ec2 instance with EFS and docker containers

Today I started to see the following error on one of my sites:
NOTICE: PHP message: PHP Warning: fopen(/www/wordpress/wp-content/languages/plugins/wordpress-seo-es_ES.mo): failed to open stream: "Quota exceeded" in /www/wordpress/wp-includes/pomo/streams.php on line 148
It's not "disk quota exceeded" which is what I mostly find when searching for the error, its just "quota exceeded".
The site runs on a container with nginx + php-fpm on an aws ec2 instance with plenty of available space, and wordpress contents are on an EFS shared filesystem. The error occurs with many files, not just the one on the error (but its the one that most appears on the logs).
I really have no idea to which quota is referring to. Any hints are very appreciated.
Thanks
EDIT (05/05/2020):
The error seems to not be specifically related to php-fpm, I started another service and the nginx container failed to start with the same error:
** [php-fpm] Starting php-fpm 7.0.33 nginx: [emerg] open() "/www/wordpress/.nginx_conf" failed (122: Quota exceeded) in
/etc/nginx/conf.d/default.conf:28
** [nginx] Starting nginx 1.17.6 nginx: [emerg] open() "/www/wordpress/.nginx_conf" failed (122: Quota exceeded) in
/etc/nginx/conf.d/default.conf:28 [04-May-2020 20:01:42] ERROR: failed
to open error_log (/www/logs/php-fpm/php-fpm.log): Quota exceeded
(122) [04-May-2020 20:01:42] ERROR: failed to post process the
configuration [04-May-2020 20:01:42] ERROR: FPM initialization failed
** [php-fpm] Starting php-fpm [04-May-2020 20:01:42] ERROR: failed to open error_log (/www/logs/php-fpm/php-fpm.log): Quota exceeded (122)
[04-May-2020 20:01:42] ERROR: failed to post process the configuration
[04-May-2020 20:01:42] ERROR: FPM initialization failed
and is not only with that container, I have found that error on all containers running on that machine, so it seems to be an o.s. error. I still cannot find what that "Quota exceeded (122)" error is.

Running into a network error when trying to download large files with a Laravel and nginx setup

I simply try to download files in Laravel with
return Storage::disk($disk)->download($path);
which is working perfectly fine. But as soon as the size of the file exceeds approximately 1 GB the download stops and Chrome says "Network error".
I've insepected the nginx error.log and this is what I have found:
readv() failed (104: Connection reset by peer) while reading upstream, client: xxxx.xxxx.xxxx.xxxx
I could not find any additional errors in Laravel log file or PHP FPM log file.
Laravel: 5.8
PHP: 7.3
nginx: 1.15.8
Is it necessary to apply any headers to the download response or do I need to tweak any php or nginx settings?

Category pages return recv() failed (104: connection reset..) Magento 1.9 multistore + nginx | php7.1 fpm

I have a multi store magento1.9 environment on ubuntu 15.04, Nginx 1.9.15, php7.1 fpm. 5 store run on it. Surprisingly, from last 5 days, two of the stores throw below error. This happens to all category pages with products.
recv() failed (104: Connection reset by peer) while reading response header from upstream, client:
We tried all other suggestions around timeouts, buffer sizes but no luck.
3 stores work absolutely well. We are stuck and your help would be appreciated.

502 gateway errors with nginx php-fpm and wordpress site

i have problems with one of 2 websites running on a centos server through NGINX + PHP-FPM.
For one of the websites running WordPress WooCommerce and a couple of plugins it feels like randomly getting 502 timeouts.
Especially on accessing category/archive or single product pages.
CPU and memory load is ok, also no errors or warnings here
What i can see from the logs is the following
/var/log/php-fpm/error.log
[27-Nov-2017 11:58:16] NOTICE: finished trace of 719
[27-Nov-2017 11:58:36] WARNING: [pool www] child 703, script '/srv/www/domain.com/public_htm/index.php' (request: "GET /index.php") executing too slow (15.478662 sec$
[27-Nov-2017 11:58:36] NOTICE: child 703 stopped for tracing
[27-Nov-2017 11:58:36] NOTICE: about to trace 703
[27-Nov-2017 11:58:36] NOTICE: finished trace of 703
/var/log/nginx/domain-error.log
[error] 30981#0: *18683 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 162.158.89.37, server: www.kixl.de, request: "GET /sneaker/asics HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001",
thats pretty much it. Sometimes pages are reachable again, otherwise i have to restart php-fpm.
I would really like to find out the real reason behind these timeouts but donĀ“t know where to look.
I already tried changing debug levels for NGINX and PHP-FPM to debug and more without getting more details what exactly causing the trouble.
I depend on the plugins and theme activated for this wordpress install so deactivating or using default theme is no option here.
Maybe someone can tell me how to find out what File, Plugin or maybe some database query causing PHP-FPM to hang, leading in the web server to timeout.

Yosemite Nginx PHP crashes on curl_exec

I have OSX 10.10 Yosemite with Nginx and PHP installed using Homebrew. I am trying some stuff with Symfony, but I have discovered that when I run my scripts, as soon as they reach the method call curl_exec, all execution is aborted and the server throws a 502 Bad Gateway error.
I created a separate script outside the Symfony scope and ran it with the PHP version I installed via Homebrew, and it worked perfectly fine. It is my assumption that there is an issue with PHP-FPM, however, as opposed to most other posts on StackOverflow, it's not like all PHP scripts are crashing, or that the curl extension isn't installed. Because all PHP scripts work, and curl method calls work, except for curl_exec.
Also, when the curl_exec function is called via Nginx, this is the line that is added to the error log:
2015/06/02 23:01:43 [error] 13355#0: *10 upstream prematurely closed
connection while reading response header from upstream, client:
127.0.0.1, server: mysubdomain.localhost, request: "GET /app_dev.php/users/create?XDEBUG_SESSION_START=19867 HTTP/1.1",
upstream: "fastcgi://127.0.0.1:9000", host: "mysubdomain.localhost:8080"
EDIT: As per nifr's request, here's what appears in my PHP error log:
[04-Jun-2015 09:25:58 America/Los_Angeles] PHP Warning: PHP Startup:
mcrypt: Unable to initialize module Module compiled with build
ID=API20131226,NTS PHP compiled with build ID=API20131226,NTS,debug
These options need to match in Unknown on line 0 [04-Jun-2015
09:26:03 America/Los_Angeles] PHP Warning: PHP Startup: mcrypt:
Unable to initialize module Module compiled with build
ID=API20131226,NTS PHP compiled with build ID=API20131226,NTS,debug
These options need to match in Unknown on line 0
However, this appears regardless of whether I use curl or not. It appears even when I so much as do a echo 'Hello World';, so I'm pretty sure this has nothing to do with curl_exec.
EDIT 2: I found another person who seems to have the same issue: php-fpm crashed when curl or file_get_contents request a https url
However, it is even more severe for them, because on my side, file_get_contents does not cause any crashes.
EDIT 3: nginx log:
[21-Oct-2015 11:39:39] WARNING: [pool www] child 73043 exited on
signal 11 (SIGSEGV) after 201.232240 seconds from start [21-Oct-2015
11:39:39] NOTICE: [pool www] child 73216 started

Categories