douzhe1264 2015-03-16 01:48
浏览 110

PHP(PHP4)使用循环更新数据在CentOS上获得“500内部服务器错误”但在Windows中没有(XAMPP)

I have about 600 record from output query. Then I make a update script with looping foreach

On windows with xampp 1.7.3 (PHP5 and MySQL5) that's run normally and fast. And sucessfully updated.

But when i upload to my host (CentOS server) i see the proccess update data is get long, and then i got 500 Internal Server Error. When the proccess running, i refresh table database, the update data is long time each row. So only about 20 record can updated, and then got 500 internal server error.

For information, on my host application server (PHP4) and database server (MySQL4) is different server.

Proccess update data with looping array :

foreach($kode as $id => $kdid) { $page->adodb->StartTrans(); $qw->sqlExecute($sql['update_data'],array($tglmasuk[$id],$no_urutan[$id],$kode[$id]), false); $page->adodb->CompleteTrans(); }

file sql :

$sql['update_data'] = "UPDATE history SET tgl_masuk = '%s', no_urutan = '%s' WHERE id_history = '%s'"

error log :

[Mon Mar 16 08:47:19 2015] [warn] [client 192.168.1.122] Timeout waiting for output from CGI script /var/www/cgi-bin/php, referer: http://myurlproccessubmit

[Mon Mar 16 08:47:19 2015] [error] [client 192.168.1.122] Premature end of script headers: php, referer: http://myurlproccessubmit

Can someone help me for solve the problem??

  • 写回答

1条回答 默认 最新

  • duanguanya3052 2015-03-16 03:29
    关注

    The error is that the script not completing within the maximum allowed execution time.

    You can try to increase the max execution time with the following command at the beginning of your script:

    ini_set('max_execution_time',120);
    

    http://php.net/manual/en/info.configuration.php#ini.max-execution-time

    max_execution_time can also be set in the .htaccess file with:

    <IfModule mod_php5.c>
    php_value max_execution_time 120
    </IfModule>
    

    You may also ask the hosting company for help.

    评论

报告相同问题?

悬赏问题

  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch