0

我正在使用 admin-ajax 在我的插件中进行 ajax 调用。因此,当出现错误时,我收到错误“内部服务器错误”而不显示错误。我看不到日志,因为我无权访问服务器?我试过这样:

 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;
   }

但它仍然返回错误而不返回结果。我知道发生错误的行,但想知道错误是什么。

4

2 回答 2

1

由于您正在处理大量数据,因此您需要检查内存限制 - PHP 通常需要比您处理的数据大小更多的内存。

所以尝试增加内存限制(如果它不适用于该值,请尝试大于此值):

ini_set('memory_limit', '128M');

或者,您可以通过将以下行添加到wp-config.php来让 WordPress 为您执行此操作:

define('WP_MEMORY_LIMIT', '128M');
于 2012-11-30T09:35:01.063 回答
-1

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

通常,它是由服务器配置错误引起的(例如错误的 .htaccess,或 httpd.conf 中的“语法”错误)。

于 2012-11-30T09:03:55.233 回答