Yosemite Nginx PHP crashes on curl_exec - php

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

Related

Internal server error 500 crashes server laravel

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.

Why is searching not returning results in Magento 1.9 with error messages appearing in nginx logs for FastCGI and Elastica?

I'm running Magento 1.9.4 on Ubuntu 18.04, PHP 7.2 with nginx 1.14 fronting it all. The shopping site is loading and navigable. However, when I search for a term, it does not list the matches in the drop-down and shows the no results page.
I can see the following message in the nginx error logs:
2020/05/22 14:54:51 [error] 1213#1213: *270 FastCGI sent in stderr: "PHP message: PHP Warning: array_keys() expects parameter 1 to be array, null given in /var/www/example.com/lib/Elastica/Status.php on line 69
PHP message: PHP Warning: in_array() expects parameter 2 to be array, null given in /var/www/example.com/lib/Elastica/Status.php on line 81
PHP message: PHP Notice: Undefined index: version in /var/www/example.com/lib/Elastica/Client.php on line 108" while reading response header from upstream, client: 72.71.71.72, server: www.example.com, request: "GET /catalogsearch/result/?q=trouser HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.example.com", referrer: "https://www.example.com/boutique/"
This was working prior to upgrading from Ubuntu 14.04 and PHP 7.0.
I need to find another job.
Magento is using Elastica client which in turn is pointing to AWS ElasticSearch service. I had to whitelist the host (Magento site) in the AWS ElasticSearch access policy in order for it to access the service.

FastCGI sent in stderr: "PHP message: PHP Warning: After migrating wordpress

I just migrate my old site from another vps to the new one. New vps is running easyengine v3.8 on a fresh debian 8 instalation.
The migration is done via rsync command. The steps of migration process are :
Create new wordpress site in new vps
Pointing DNS to new IP, new site running well.
Remove all wordpress files in /var/www/mydomain.com/htdocs
Dump mydomain.com's database in old vps
Migrating data ( including dumped database ) from old vps to new vps via rsync
Import database in new vps.
Edit wp-config.php
Unfortenately, my new site wasn't live at all. Instead, it gives a HTTP 500 error with blank white screen. Even after i enable WP_DEBUG, the screen still white with no message on it.
I've tried to deactivate all plugins, still no change. Then i look to error log ini /var/www/mydomain.com/logs/error.log, it show message like this :
2019/01/16 01:03:37 [error] 8811#0: *849 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
PHP message: PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
PHP message: PHP Fatal error: Unknown: Failed opening required '/var/www/html/mydomain.com/wordfence-waf.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0" while reading response header from upstream, client: 167.248.155.196, server: mydomain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mydomain.com"
From this message, I notice there is a different webroot location, old webroot is located under /var/www/html/mydomain.com , while new webroot is located under /var/www/mydomain/htdocs.
is there any suggest? Thank you.

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.

Does PHP 5.5 work with MongoDB driver?

I've just installed PHP 5.5 and I am no longer able to use MongoClient and I'm getting frustrated trying to figure out why.
This doesn't work:
$m = new MongoClient("mongodb://workplz.com");
My nginx error log shows:
2013/07/05 10:40:16 [error] 4163#0: *698 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'MongoClient' not found in /blah/test.php on line 2" while reading response header from upstream, client: 123.123.123.123, server: blah, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/freecookies.sock:", host: "blah"
I do have extension=mongo.so in my php.ini.
When I do phpinfo() it shows under Mongo Version 1.4.1
Extra info:
PHP Version 5.5.0-1ubuntu2~precise1
nginx/1.4.1
Edit
When I try to execute it from php-cli I get the same thing:
PHP Fatal error: Class 'MongoClient' not found in /blah/test.php on line 2
Double check your php.ini, you're probably using the wrong one. There are several for different ways to invoke PHP.

Categories