PHPExcel $objWriter->save('php://output'); on php 7.0 ubuntu 16.04 not working

2.7k views Asked by At

Earlier on php 5.6 file got saved. After updating to php 7 and os to ubuntu 16.04. It is not working

$objPHPExcel->getActiveSheet()->setTitle('KYC Report');
                $objPHPExcel->setActiveSheetIndex(0);
                //print_r($objPHPExcel);die;

                // Redirect output to a client’s web browser (Excel5)
                header('Content-type: application/vnd.ms-excel');
                 // It will be called file.xls
                 //header('Content-Disposition: attachment; filename="sectionlist.xlsx"');
                if (Yii::app()->user->checkAccess('Magicbus-admin') || Yii::app()->user->checkAccess('Magicbus-accountant')) {
                    header('Content-Disposition: attachment;filename=Transaction Report"' . date('ymdhis', time()) . '.xlsx');
                } else {
                    header('Content-Disposition: attachment;filename=KYCReport-"' . date('ymdhis', time()) . '.xls');
                }
                header('Cache-Control: max-age=0');

                $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
                ob_end_clean();
                ob_start();
                $objWriter->save('php://output');
                Yii::app()->end();

I am using PHPExcel 1.8 on yii 1.Both php version are enabled on server ie. 5 and 7.

0

There are 0 answers