-2

So, I have 500 error on a page and I want more information why I do have error (because the page works fine in local but not on my server)

I try the following solution preconised in This topic but it doesn't help. I restarted nginx everytime and no changes.

Here is the folder on my server (VPS, no cPanel) :

folder

here is my actual state of php.ini :

http://pastebin.fr/75379

Any clue ?

1 Answers1

1

What you placed at the top of your PHP.INI file is what you would use in an actual .php file to turn on error reporting / show errors on a per file bases. You do not add that to your PHP.INI file.

Example of use in a .php file:

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');

If you search your PHP.INI file you will find error_reporting = E_ALL, and display_errors = On are set.

Notice the definitions in the PHP.INI file:

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; For production environments, we recommend logging errors rather than
; sending them to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = On

You should not display errors in a production environment. You don't want to reveal any extra information to any potential hackers. Also these errors will mean nothing to your users. You should just show a generic error page and log all your errors for your review.

In a development environment I would have them all on and display_startup_errors = On.

I see log_errors = On so you should be getting your error messages logged to: /var/log/nginx/default-error.log. I suggest looking there to find your issue after you fix your PHP.INI file.

mikeroq
  • 252
  • 2
  • 7
  • Ah ok I didn't get the – Benoit Adam Nov 28 '20 at 00:22
  • and yeah I'm always display error shouldnt be display in production env of course, but it's a small and private website anyway. Tryed by the log but seems unreadable. Also I don't have the default-error.log, just error.log https://imgur.com/a/7PzaMzJ – Benoit Adam Nov 28 '20 at 00:24