Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php wordpress插件管理ajax-内部服务器错误的打印错误_Php_Wordpress - Fatal编程技术网

Php wordpress插件管理ajax-内部服务器错误的打印错误

Php wordpress插件管理ajax-内部服务器错误的打印错误,php,wordpress,Php,Wordpress,我正在使用admin ajax在我的插件中进行ajax调用。因此,当出现错误时,我会得到错误“InternalServerError”,而不显示错误。我无法查看日志,因为我无法访问服务器?我试着这样做: try{ $req = new WP_Http; //$headers = array('Transfer-Encoding'=> 'chunked'); $res = $req->request("url", array('method' =&g

我正在使用admin ajax在我的插件中进行ajax调用。因此,当出现错误时,我会得到错误“InternalServerError”,而不显示错误。我无法查看日志,因为我无法访问服务器?我试着这样做:

 try{

     $req = new WP_Http;
    //$headers = array('Transfer-Encoding'=> 'chunked');  

    $res = $req->request("url", array('method' => "POST", 'body' => $data) );
  //Getting error at this line when size of $daya is more than 10MB. Till 10MB, it is sending post data successfully.
    //After 10MB(approx), getting Internal server error.
     //But cant just think this is server restriction to max post data, as phpinfo saying that max_post_size as 64MB
 }
  catch(Exception $e){
       echo $e;
   }
但它仍然返回错误而不返回结果。我知道发生错误的行,但想知道错误是什么

500(内部服务器错误)是HTTP错误,而不是PHP错误


通常,这是由于服务器配置错误(如.htaccess错误或httpd.conf中的“语法”错误)造成的。

由于您处理的是大量数据,因此需要检查内存限制-PHP通常需要比您处理的数据大的内存

因此,请尝试增加内存限制(如果无法使用该值,请尝试使用大于此值的值):

或者,您可以让WordPress为您这样做,方法是将以下行添加到:


您能否尝试在WP-config.php中将
WP\u DEBUG
设置为
true
?这通常会显示致命错误。我可以使用wordpress dashboard进行编辑吗?很遗憾,没有。。。您可以尝试添加
错误报告(E_ALL);ini设置(“显示错误”,1)到你的functions.php,看看是否有效。你的内存限制是多少?也许这就是问题的原因;解决了这个问题。请写在上面的答案,所以我标记为答案,并将投票给你。事实上,这并不总是正确的。如果PHP抑制错误,并且您的代码触发了致命错误,那么您将得到一个内部服务器错误。我在许多服务器上看到过这种情况,包括我在计算机上运行的Apache。我必须将
WP_DEBUG
设置更改为true,以便查看触发该错误的相关信息。
ini_set('memory_limit', '128M');
define('WP_MEMORY_LIMIT', '128M');