More specific error 500

Asked

Viewed 566 times

1

I am working on a PHP web application.

The problem I am facing is that the application is working 100% locally, but when I play on the server some things present the error 500. But the error 500 is very abstract, I end up getting lost, I look at the code and it’s all right.

Is there any way I can more specifically display which error is occurring?

Console:

inserir a descrição da imagem aqui

NOTE: I could debug with var_dump and console.log or something, the problem is that when I go up the site it takes at least 15min to complete the deploy.

NOTE²: I use AWS server (Amazon Web Services)

  • 8

    One of the first habits that anyone who deals with PHP should create, in my view, is to always keep an eye on the error log.

  • 1

    You can go to the network tab and check if you have more details about the error by selecting the request that resulted in failure

  • 2

    @Jrd considering that the network tab works on the client side and the 500 error occurs on the server side, I find it unlikely that you will find many details in the specific case. (but I see no harm in looking there, obviously)

  • 3

    @Jrd error 500 indicates a Generic error occurred in the application in back-end, there on the console already appears the error page, however Otavio, the problem may be the version of your PHP that is different from the server and your PHP may be written in a way that is not compatible with your hosting. Another possibility is that you forgot to set up something, like a bank. But only with this information it is impossible to help you at the moment.

  • @Bacco I’ll check this log there, thanks!

  • @Jrd actually I’ve already looked at the network, it has no information about the error.

  • @Guilhermenascimento The version I believe is correct, because the application is already ready and in the air for a while, I just change and go up, I was not the one who developed. Anyway, I’ll take a look, thanks!

  • 2

    @Otaviosouzarocha maybe something you added, maybe something that changed the syntax, maybe some include, maybe the way you uploaded via FTP (yes, this can truncate the files), could be countless things.

  • @Guilhermenascimento yes, error 500 is too wide, exactly this my problem, I need to see more specifically what is occurring, I will try to find the log to see if I can see

Show 4 more comments

1 answer

6


Hello, I always go through this and I usually solve like this:

Creating an asynchronous version and asking PHP to show errors:

#início do arquivo
error_reporting(E_ALL);
ini_set('display_errors', 'on');
ini_set("log_errors", 1);
ini_set("error_log", "/tmp/erro.log"); // não sei ao certo se isso corrige o delay que você disse ter

to try to make this asynchronous URL practical, maybe this will help:

$.ajax({
    statusCode: {
        500: function() {
        console.log(versao-assincrona.php?var1&var2...);
        }
      }
   });

this gives me speed as error 500 appears and I already test the asynchronous URL in another tab with php displaying errors.

I solve it like this, but there may be better ways.

I hope I’ve helped

Browser other questions tagged

You are not signed in. Login or sign up in order to post.