0

I am developing a large PHP web application in VScode. The error reporting in development mode is switched on (E_ALL and display_errors 1) and my AJAX calls in Javascript always provided clear information about any errors on the PHP side. This happened through the request.responseText varialble of the error function of the AJAX call.

Since a few weeks all of a sudden my PHP error reporting is reduced to just "500 Internal server error" without any reference to a line number or any details about the source of the error.

Does anyone have any idea what could have caused this sudden change?

Below an example of the AJAX calls:

$.ajax({
    type: 'post',
    url: '../ajax_system.php',
    data: {
        'system_num': 1.5
    },
    success: function (response) {
       //do whatever you need to do with the response
    },
    error: function (request, status, error) {
        alert('failed in AJAX-call in javascript_filename.js: \n' + request.responseText);
    }
});

The 'request.responseText' variable used to give me perfectly detailed feedback, but now it just shows a 500 - Internal server error

I tried reviewing the error reporting settings in PHP, but they are all still configured correctly

  • Can u add some code so I can understand what the problem is? – Slamnka May 26 '23 at 14:31
  • What have you changed in the meantime? What else have you tried to resolve the problem? – Nico Haase May 26 '23 at 14:34
  • It's probably a good idea that errors are not being reported to the screen. Check your server error logs, and it should give you more information. If you're using Linux, it's usually found in a web-server-related folder under `/var/log` – aynber May 26 '23 at 14:38
  • The AJAX call itself does not cause any 500 error. If the PHP script does that, share its code – Nico Haase May 26 '23 at 14:48
  • @aynber this is a development environment, so it is useful to have the errors reported to the screen. – Dennis_SCC May 26 '23 at 14:48
  • In that case, I'd say go through the suggestions in https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display – aynber May 26 '23 at 14:50
  • If your server solely returns an error 500 without any additional information, your server is not configued properly for a development environment. Nevertheless, in both cases you could see log entries somewhere else – Nico Haase May 26 '23 at 14:50
  • @NicoHaase The PHP code could be anything. It is a large project with many AJAX calls. Whenever the PHP caused an error, it used to give the line number and reason. No so anymore. – Dennis_SCC May 26 '23 at 14:50
  • "Anything" - really? Any PHP code you execute, and even a simple `echo 'hello world';`, triggers an error 500? – Nico Haase May 26 '23 at 14:51
  • @NicoHaase No no!!! If the PHP code is good it won't throw an error. Only when there is something wrong with the code. Because I now don't get a line number in the feedback, it is very difficult to trace back where the PHP error is located. – Dennis_SCC May 26 '23 at 14:53
  • It might be logging to a file instead. Check the config in your php.ini – ADyson May 26 '23 at 14:54
  • And how should we know which parts are causing the problem if you don't share them? – Nico Haase May 27 '23 at 13:31
  • @NicoHaase The PHP code causing the errors isn't part of my question. It could really be any type of error in the PHP code. Until recently I would receive details of the error (any error) through request.responseText of the Jquery AJAX call. And now I just get the "500 - Internal server error". Since yesterday I did setup a logfile in the PHP.ini, and the error details ARE appearing there. This is good news, in the sense that I can get on with my project for now, but it remains a mystery as to why the on-screen error details stopped showing. Any suggestions would be much appreciated. – Dennis_SCC May 27 '23 at 15:37
  • 1
    Presumably some update or other changed a setting. We can't really say, without having access to your system – ADyson May 27 '23 at 16:38
  • Fair enough. It was worth a try. Thanks everybody for your thoughtful input. – Dennis_SCC May 27 '23 at 17:41

0 Answers0