Nginx Php-fpm not logging 500 error anywhere - nginx

Nor do nginx or php-fpm reports a error 500 output, In fact the 500 response is on the access log and not on the nginx error log. The script is running ok in my dev environment.
nginx version: nginx/1.6.2
PHP 5.5.19 (fpm-fcgi)
Tried this
catch_workers_output = 1
Restarted everything, still not working
nginx access log shows:
x.x.x.x - - [12/Dec/2014:19:25:08 -0200] "GET /merchant/customer/mobile/data?sEcho=1&iColumns=3&sColumns=%2C%2C&iDisplayStart=0&iDisplayLength=10&mDataProp_0=0&sSearch_0=&bRegex_0=false&bSearchable_0=true&mDataProp_1=1&sSearch_1=&bRegex_1=false&bSearchable_1=true&mDataProp_2=2&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch=&bRegex=false&_=1418418256370 HTTP/1.1" 500 589 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"
Note the 500 error, which should be on error.log and with the php trace that's is happening on other errors.
Any clues?

When PHP display_errors are disabled, PHP errors can return Nginx 500 error.
Take a look into your php-fpm logs, i'm sure you'll find the error there. With CentOS 7 :
tail -f /var/log/php-fpm/www-error.log
You can finally show PHP errors. In /etc/php.ini, change :
display_errors = Off
to :
display_errors = On
Hope it helps.

In case it helps someone else (Google brought me here), I had a similar problem (although in Apache, not nginx).
An older app I was installing was giving a 500 error with no output anywhere, in spite of every conceivable error logging setting turned to the most verbose level.
It turns out the problem was the controversial error-control operator, "#". As the red warning box in the docs states, no matter how verbose your logging is, if an #-prefixed command causes PHP to stop because of a typo, or because it is not available (say, because you have forgotten to install a critical module like php-mysql), PHP will exit with absolutely no indication as to why.
So, if you find yourself with a 500-error and no logs, check your codebase for "#" symbols.

Verify php-fpm service is running
sudo service php-fpm status
This will display the hostnames that can execute php.
Next edit php.ini to display errors. this will display errors on page..to make things easy to diagnose
sudo vim /etc/php.ini
then hit key [/] and type
display_errors
hit key [i] user arrow keys and backspace to set display_errors = on
then restart php-fpm service
On system type redhat /centos etc..
sudo service php-fpm restart

Related

How to debug a wordpress plugin that gives timeout

I have a site that have some plugins, and one of those plugins (facebook for woocommerce) is loading until it returns a timeout error (504). I can change some constants in wp-config.php, but none of them works when I need to debug a timeout.
I tried to remove every configuration and file that I found from this plugin and then reinstall it, but the error is still there.
I tried to deactivate every other plugin, but woocommerce and the error is still there.
I looked for some debug plugins, but I only found plugins that change wp-config.php constants and do some logs at files. It is useless, I can do this.
I tried to put some "die" with messages in plugin's code, but nothing changed.
Server log just shows this:
x.x.x.x - - [09/Nov/2020:17:52:56 -0300] "xxxxx.com" "GET /wp-admin/admin.php?page=wc-facebook HTTP/1.1" 504 160 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0" "-"
I don't know what I can to do to debug this timeout, I've tried everything I know with the wordpress.
I solved by asking on plugin's forum: https://wordpress.org/support/topic/plugin-page-giving-timeout-504/#post-13687667
I just needed to activate WP_DEBUG and WP_DEBUG_LOG flags. I discovered the line that was breaking the site and then I could properly debug and find the problem.

Downloading failed. cURL error 7: . Wordpress can't update anything

Hi!
Please, help. I want to update WordPress(or plugins), but always the same error: 'Download failed: cURL error 7: .'
OS: Linux Fedora 30. Server: nginx. DB: MySQL 8.0. PHP 7.3
I have installed all the needed PHP extensions. Curl is working - I tested to download google HTML using curl and info.php says thas cURL is enabled.
Why WordPress can't update anything? Nginx error.log does not have mistakes. On another laptop (Windows 10) with the same development environment, everything works.
What information should I give you to solve this problem?
error on the WordPress site
cURL info (info.php)

Homebrew Nginx not running but says it is in brew services

I have OSX El Capitan. I installed Nginx-Full via homebrew. I am supposed to be able to start and stop services with
brew services Nginx-Full Start
I run that command and it seems to start no problem. I check the running services with
brew services list
That indicates that the Nginx-Full services is running. When i run
htop
to look at everything that is running Nginx does not show up and the server is not handling requests.
nginx is failing to launch because of an error, but brew-services is not communicating that to you.
Running it with sudo, as other users have suggested, is just masking the problem. If you just run nginx directly, you may see that there is actually a configuration or permissions issue that is causing nginx to abort. In my case, it was because it couldn't write to the error log:
nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)
2020/04/02 13:11:53 [warn] 19989#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/etc/nginx/nginx.conf:2
2020/04/02 13:11:53 [emerg] 19989#0: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)
The last error is causing nginx to fail to launch. You can make yourself the owner of the logs with:
sudo chown -R $(whoami) /usr/local/var/log/nginx/
This should cause subsequent config errors to be written to the error log, even if homebrew services is not reporting them in stderr/stdout for now.
I've opened an issue about this: https://github.com/Homebrew/homebrew-services/issues/215
The log path may not the same for everyone. You can check the path to log file by checking the config file /usr/local/etc/nginx/nginx.conf. You can find a line like:
error_log /Users/myusername/somepath/nginx.log;. Change the chown command above accordingly. If even this didn't solve the problem, you may have to do the same for any other log files specified in the server blocks in your nginx configuration
Try launching it with "sudo", even if the formula say
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
sudo brew services Nginx-Full start
this worked for me:
sudo brew services start nginx
Running sudo nginx worked for me, it initially gave some error stating certain file in certain directory is missing, creating that file, and then another file is asked for to be created and then it runs properly.
I had similar problem, running it brew services start nginx used to show nginx running.
but brew services list used to show error.
running with sudo nginx solved my issue

Passenger standalone rise nginx error on --ssl

I trying to start passenger with SSL on mac os localhost but get this:
nginx: [emerg] invalid number of arguments in "ssl_certificate" directive in (way to config)
everything worked well just before I reinstall mac os from a backup image. All looking same as long as I can see.
Any ideas where to look?
Passenger author here. This probably means you didn't specify --ssl-certificate and --ssl-certificate-key as well. Which Passenger version are you using, what is your exact invocation?

Why does Passenger 3.0 with nginx crash on startup(?) then 403s?

On Ubuntu with REE 1.8.7, with nginx 0.8.53 manually compiled with the
Passenger 3 module doc installed as per the docs, I get an error in
the nginx error log when nginx starts:
Unable to start the Phusion Passenger watchdog because it encountered
the following error during startup: Unable to start the Phusion
Passenger logging agent: an error occurred while sending startup
arguments: Broken pipe (32) (-1: Unknown error 18446744073709551615)
I assume this means nginx never starts properly. When I try and view
my site after this, I get a 403.
2010/10/22 00:56:47 [error] 13874#0: *1813942 directory index of "/var/
rails/myapp/current/public/" is forbidden, client: 125.197.115.16,
server: new.myapp.fm, request: "GET / HTTP/1.1", host: "new.myapp.fm"
I expect the first is probably causing the second. I haven't had any
luck googling this. Can anyone provide insight or help me
troubleshoot?
I got this after upgrading to Passenger 3.0.1 as I had not changed the version of Passenger specified by passenger_root in /opt/nginx/conf/nginx.conf. You might need to change the line that looks like this to specify the correct version:
passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-3.0.1;
You get told to do this when you install nginx. Hope that helps.
I ran into this problem too, and it was because passenger couldn't find ruby:
tail -f /var/log/nginx/error.log
2011/12/20 00:54:45 [alert] 30300#0: Unable to start the Phusion Passenger watchdog because it encountered the following error during startup: Unable to start the Phusion Passenger helper agent: it seems to have crashed during startup for an unknown reason, with exit code 1 (-1: Unknown error)
* Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: ruby: No such file or directory (2)
Even though ruby was properly listed within the system PATH, it didn't seem to work right until I added:
passenger_ruby = /usr/local/bin/ruby;
(the location of my ruby executable) into the http section of my nginx config.
The problem was that PassengerLoggingAgent wasn't installed when I did 'gem install passenger'. I installed it as per this discussion (by grabbing it from the standalone zip) and everything is fine now: http://groups.google.com/group/phusion-passenger/browse_thread/thread/323dc1c7b0e5ee11

Resources