我在 Kohana 中建立了一个网站,我正在尝试允许上传 Excel 文件。我正在使用 PHPExcel 读取数据。它在我的本地服务器上运行良好,但在远程服务器上失败。(远程服务器托管在 xmission.com)
所以控制器中的代码如下:
public function action_bulk_upload()
{
if ($path = Kohana::find_file('vendor', 'PHPExcel')) {
require_once $path;
}
$objPHPExcel = PHPExcel_IOFactory::load($_FILES['upload']['tmp_name']);
$worksheet = $objPHPExcel->getActiveSheet();
$range = range('A', 'Z');
$data = array();
$i = 1;
while ($worksheet->cellExists('A' . $i)) {
$row = array();
foreach ($range as $letter) {
if (!$worksheet->cellExists($letter . $i)) {
break;
}
$cell = $worksheet->getCell($letter . $i);
$row[] = $cell->getValue();
}
$data[] = $row;
$i++;
}
$worksheet = null;
$objPHPExcel->disconnectWorksheets();
$objPHPExcel = null;
$view = View::factory('content/admin/events/bulk_form')
->bind('data', $data);
$this->add_content($view);
// The code gets here
}
该代码一直通过控制器,但不幸的是我收到了 500 内部服务器错误。错误日志说:
[Wed Jun 26 12:45:08 2013] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Jun 26 12:45:08 2013] [warn] (104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request function
听起来我好像需要更改 FastCgi 设置,但它是一个共享主机帐户,所以我可能无法更改。谢谢您的帮助!