如何跟踪500个内部服务器错误的原因? [英] How to trace the cause of a 500 internal server error?

查看:65
本文介绍了如何跟踪500个内部服务器错误的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用FB的官方PHP SDK进行以下操作:

I'm trying to do the following using FB's official PHP SDK:

$facebook->api(
'/me/feed',
'POST',
array(
    'link' => 'test',
    'message' => 'test'
)

)

不幸的是,服务器(不是Facebook!)返回了500错误.

Unfortunately, the server (not facebook!) returns a 500 error.

请求通过,状态被发布,但是我的服务器返回错误.

The request goes through, the status gets posted, but my server returns an error.

我的问题是,如何找出原因?

My question is, how do I find out what's the cause of it?

推荐答案

500通常是内部服务器错误".

500 is generally "internal server error".

如果您从Facebook api调用中获得500返还,那么在他们的端头可能有问题.

If you get 500 back from your facebook api call, then it might be something wrong on their end.

再一次,您的HTTP请求可能会有些偏离,并且fb服务器变为嗯,什么?"并向您发送500,因为它无法解释问题.

Then again, your HTTP requests might be a little off, and the fb server goes "um, what?" and sends you a 500 because it can't explain the problem.

我记得很多年前,fb api在出现问题时返回了大多数未知错误"代码-从那以后再也没有接触过该api.希望您不会遇到相同的问题.

I remember a number of years ago the fb api returned mostly "unknown error" codes when something went wrong - haven't touched that api since. Hopefully you're not running into the same problem.

要真正解决问题,您将需要:

To really solve the problem, you will need to either:

A)捕获您的HTTP请求和响应(包括标题),将其与成功的api调用进行比较,并在需要时进行更改. B)捕获facebook SDK引发的所有异常.

A) capture your HTTP request and response, including the headers, compare it to a successful api call, and make changes if needed. B) capture any exceptions thrown by the facebook SDK.

选项A将始终有效,但选项B可能会更快.

Option A will always work, but option B is perhaps quicker.

签出: php异常

要查看是什么导致您的服务器上出现500错误,请查看您的Apache错误日志.

to see what is causing a 500 error on YOUR server, look in your apache error logs.

您也可以使用

error_reporting(E_ALL);

排除任何php错误.

这篇关于如何跟踪500个内部服务器错误的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆