Reading excel file in PHP with PHPExcel library -
when try read uploaded excel file upload folder phpexcel library, can cause error , can't find reason. according nginx log, there "connection reset peer" error below:
[error] 111#111: *124 recv() failed (104: connection reset peer) while reading response header upstream, client: 172.17.0.1,
until line $objphpexcel = $objreader->load( $file_name );
seems fine on line, file can not executed , besides this, there isn't exception in catch block.
as result of problem, nginx gives 502 bad gateway
error in browser.
public function load_excel( $file_name ) { try { /** identify type of $inputfilename **/ $inputfiletype = \phpexcel_iofactory::identify( $file_name ); /** create new reader of type has been identified **/ $objreader = \phpexcel_iofactory::createreader( $inputfiletype ); /** advise reader want load cell data **/ $objreader->setreaddataonly( true ); /** load $inputfilename phpexcel object **/ $objphpexcel = $objreader->load( $file_name ); } catch(\phpexcel_reader_exception $e) { error_log($e->getmessage()); return false; } return $objphpexcel; }
Comments
Post a Comment