开发者

How to resolve 500 Internal Server Error? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
开发者_开发问答

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 2 years ago.

Improve this question

I am getting "500 Internal Server Error" when I used ajax call. What is causing this problem? How to resolve it?


debugging, fixing, and resolving a server error from an Ajax call is exactly the same process as any other request.

  1. Check the web server error logs for any indications of what the error is

  2. Introduce debug statements into the serverside code around where the error is occuring (and add a little bit to your ajax request to dump all the response as plain text)

It may also be useful to copy the URL and querystring used in the Ajax call and paste it into your browser to view any responses.

Firebug for Firefox is also a useful diagnostic tool for testing what is being sent as part of the Ajax call and what is being sent back as a response.


Use fiddler or firebug to look at your network request/response.

It looks like you may be using perl? Try adding use CGI::Carp qw(fatalsToBrowser); on a new line after your path to perl declaration.


I was working on a customer's server and had problems executing PHP code. I checked on the CPannel the errors and it was just a permissions error. The PHP files had to be set with non writable permissions for groups. In my case setting the permissions to 644 got everything working.


If your server is running Windows, then look in the event log and see what server error occurred.


Look in the server log, which on Linux is normally in something like /var/log/apache2 or /var/log/httpd.

Download Firebug, intercept the ajax call and load it in the browser or look at its output. Make sure you server is set to report errors (look at php.ini for PHP settings, for example). Whatever is causing it is probably going to show up.

Make sure you don't actually throw the error 500 yourself in the code.

If you use PHP, then use a debugger, such as PHPEd or xdebug and step through the code. That's the way I debug my PHP and it's the best way, though takes some time to set up.


You created and fired off a request to a server with whatever you did in Ajax. So far, so good. The server tried to process your request but ran into an error condition. That's usually caused by some bug in the server code.

As John Saunders advises, you can usually get more information on the server-side problem by looking into its logs.


My step usually (in particular order):

  1. open firebug and look up the particular ajax request from console. Then, see the parameter, header, and URL request. Examine each data to see what goes wrong. If it all seems OK
  2. I will look at my server log (httpd-error.log on Apache) and check any particular error that came from that request.
  3. Fix what is wrong based on all there checking.


I was also facing the same error today. It mostly occurs because of wrong folder/file name because name of folders and files when linking/ sending ajax requests is case-sensitive on actual servers (not in Server simulators e.g. WAMP/XAMPP). So, check your file path to which you are sending the request and the problem may get solved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜