1 (edited by ayhanbaris 2017-04-26 12:23:37)

Topic: End of script output before headers: index.php

hello,

Operating system CentOS Linux 7.3.1611
Webmin version 1.831
Virtualmin version 5.07

i m getting this error when i use phpexcel writer; (laravel 5.3)

$objWriter = \PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
$objWriter->save(storage_path('form'.$form->id.'.xlsx')) ;

End of script output before headers: index.php
[fcgid:error] [pid 10498] mod_fcgid: process /home/SITENAME/fcgi-bin/php7.1.fcgi(10637) exit(communication error), get unexpected signal 1

switched to CGI wrapper (run as virtual server owner) , and:

End of script output before headers: php7.1.cgi, referer:
kernel: php-cgi[1042]: segfault at 8 ip 00007f8603990195 sp 00007ffeb812baf0 error 4 in php-cgi[7f8603743000+40d000]


i cant fix it.


-i disabled all caching. apc opcache ...
-i m using laravel 5.3
-everythink was fine befor phpexcel library.
-phpexcel 's save() function is the beging of segfault.

* packages from : el7.remi.x86_64

my original post: https://www.virtualmin.com/comment/775530

Re: End of script output before headers: index.php

Can you provide a minimal reproducer and (if possible) a backtrace ?

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70

3 (edited by ayhanbaris 2017-04-26 13:39:43)

Re: End of script output before headers: index.php

centos7
php7 or php7.1 , remi, (no apc, no opcache...)
laravel 5.3 basic project
add phpoffice/phpexcel with composer to laravel

function:
public function createExcelFromTemplate()
{
    $excel = \PHPExcel_IOFactory::createReader('Excel2007');
    $excel = $excel->load(storage_path('template.xlsx'));

    $excel->setActiveSheetIndex(0);

    $excel->getActiveSheet()
        ->setCellValue('D9', 'TEST’);

    $objWriter = \PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
    $objWriter->save(storage_path('new-file.xlsx')) ; // <<<<< this is the segfault beginning
}

Re: End of script output before headers: index.php

it works with centos-release-scl PHP70
(https://wiki.centos.org/AdditionalResou … tories/SCL)

(all same code, php version, server...)

Re: End of script output before headers: index.php

Simplify to only  (to avoid pulling Laravel)
Template pulled from the Examples dir.
Run from command line

<?php
require 'vendor/autoload.php';

@unlink('new-file.xlsx');

$excel = \PHPExcel_IOFactory::createReader('Excel2007');
$excel = $excel->load('template.xlsx');

$excel->setActiveSheetIndex(0);

$excel->getActiveSheet()
      ->setCellValue('D9', 'TEST');

$objWriter = \PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
$objWriter->save('new-file.xlsx');

I cannot reproduce the segfault with 5.6, 7.0, 7.1 or even 7.2...
So... not enough information.

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70

Re: End of script output before headers: index.php

> [fcgid:error] [pid 10498] mod_fcgid: process /home/SITENAME/fcgi-bin/php7.1.fcgi(10637) exit(communication error), get unexpected signal 1

BTW, do you really still use mod_fcgid ?
Seriously ?

Why not a modern way, such as php-fpm ?

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70

Re: End of script output before headers: index.php

yes i still, seriously use.
thank you.