Estou com um problema ao tentar exportar arquivo para Excel em PHP.
Tentei com a biblioteca PHPExcel
mesmo ela estando obsoleta/descontinuada e testei com a PhpSpreadSheet
também. Porém as duas apresentou o mesmo erro e somente no PHP 7.1.20.
Erro apresentado:
"o excel não pode abrir o arquivo porque o formato ou extensão de arquivo não é válida"
Quando aberto com algum editor de texto, apresenta está mensagem:
Fatal error: Uncaught PhpOffice\PhpSpreadsheet\Writer\Exception: Could not open php://output for writing. in C:\DESENV\DefaultCollection\STCPWebAdmin\Site\www\cgi-bin\libs\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx.php:218
Stack trace: < #0 C:\DESENV\DefaultCollection\STCPWebAdmin\Site\www\stcpwebversionxls.php(104): PhpOffice\PhpSpreadsheet\Writer\Xlsx->save('php://output')
< #1 {main} thrown in C:\DESENV\DefaultCollection\STCPWebAdmin\Site\www\cgi-bin\libs\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx.php on line 218
Testei nas versões 7.1.14 e 7.1.17 e funcionou normalmente.
Sabem o motivo?