dqsh30374 2012-03-20 16:02
浏览 44
已采纳

卷曲PHP - 奇怪的内部服务器错误

I have 2 servers. Server 1 has the engine/api. Server 2 has apache2 and my website.

From the website I try do a simple curl to the engine. If the curl lasts more than ~15sec I get internal server error. If I run this script from bash (not using a browser) I get status 200 and an answer. When I run this script from localhost to the engine it runs ok. But, when I want connect from my server via browser to engine - I get the internal server error after 15s.

I don't have any information in apache2 error_log. In php.ini I have the execution time = 120 and in apache I have 300 timeout. Do you have any idea what is wrong? (My server runs under debian lenny.) Sorry for my bad English.

$data = "Test text";
$_data['post'] = 'source_text='.urlencode($data);
$_data['url'] = ENGINE_PATH;
$_data['access'] = HTACCESS_LOGIN.':'.HTACCESS_PASSWORD;
$_curl = curl_init();

if(!empty($_data['post'])){
    curl_setopt($_curl, CURLOPT_POST, 1);
    curl_setopt($_curl, CURLOPT_POSTFIELDS, $_data['post']);
}

if(substr($_data['url'],0,5) == 'https'){
    curl_setopt( $_curl, CURLOPT_SSL_VERIFYPEER, false );
}

curl_setopt($_curl, CURLOPT_URL, $_data['url']);
curl_setopt($_curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($_curl, CURLOPT_TIMEOUT, 60);
curl_setopt($_curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($_curl, CURLOPT_HEADER, 0);
curl_setopt($_curl, CURLOPT_FOLLOWLOCATION, 1);

if(!empty($_data['access'])){
    curl_setopt( $_curl, CURLOPT_USERPWD, $_data['access']);
}

$agent = 'Mozilla/5.0 (X11; U; Linux x86_64; pl-PL; rv:1.9.2.22) Gecko/20110905 Ubuntu/10.04 (lucid) Firefox/3.6.22';

if(!empty($_SERVER['HTTP_USER_AGENT'])){
    $agent = $_SERVER['HTTP_USER_AGENT'];
}

curl_setopt($_curl, CURLOPT_USERAGENT, $agent);
curl_setopt($_curl, CURLOPT_FAILONERROR, 1);

$data = curl_exec($_curl);

EDIT

I do simple script php -

 echo '1';
 sleep(16);
 echo '2';

But I get 500 error too. I try this in apache2 and lighttpd. Than I pretty sure - this is error configuration on system...

EDIT Problem is solved. The problem was configuration of server pound. Thank you for help.

  • 写回答

2条回答 默认 最新

  • doubengman2072 2012-03-20 16:34
    关注

    Carefully check the logs. To display the error, add the following code:

    ini_set('error_reporting', E_ALL);
    error_reporting(E_ALL);
    ini_set('log_errors', true);
    ini_set('html_errors', false);
    ini_set('error_log', dirname(__FILE__).'script_error.log');
    ini_set('display_errors', true);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 如何提取csv文件中需要的列,将其整合为一篇完整文档,并进行jieba分词(语言-python)
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置