Difference in behavior with PhpExcel running on windows and Ubuntu

Topics: Developer Forum, User Forum
Oct 5, 2012 at 3:03 PM

Hi All,

I hope someone out there can help me. I installed my Cakephp based application on an Ubuntu server today. Previously it was running on a Debian server and I develop on a windows machine. I have noticed that a PhpExcel based function is behaving differently on the Ubuntu server and I do not know why....
What this code does is open a template Excel file, change some values and then sends the output to the browser so that it can be downloaded. This works fine on Windows/Debian but for some reason when I just try to open a reader/write to the output on the new server it add new numbered sheets to the outputted excel file. Eg the file has two sheets: 'monkey', 'cat'. and the output contains 'monkey' ,'cat', 'monkey 1' and  'cat 1'. Plus the styling of the sheets are messed up. 

Can anyone explain this to me? Perhaps it is a lamp config setting that is missing but right now I do not know. 

Here an example of the the Code (it just opens a file and writes it to the output):

			$objPHPExcel2 = new PHPExcel();
			$objReader2 = PHPExcel_IOFactory::createReader('Excel2007');
			$inputFileName = "files/templates/FragebogenExportTemplate.xlsx";
			$objPHPExcel2 = $objReader2->load($inputFileName);

			$objWriter2 = new PHPExcel_Writer_Excel2007($objPHPExcel2);
				

			ob_clean();
			header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
			header("Content-Disposition: attachment; filename=".$lieferant['Lieferant']['ifa']."_fragebogen.xlsx");
			
			// Write file to the browser
			$objWriter2->save('php://output');
			exit();		

Any suggetions? Thanks guys.

Coordinator
Oct 7, 2012 at 7:41 AM

I keep hearing about this problem with PHPExcel duplicating worsheet names, but have never seen it myself, never been able to replicate the problem; and until I'm able to test it for myself I have no way of addressing it.

 

Can you please upload an example of the template file; together with a phpinfo() dump of the php configs for each of the two servers. The only thing I can think of that might cause this is mbstring settings.

 

Oct 11, 2012 at 12:31 PM

Hi Mark,


Many thanks for answering my post. I still have not figured this out. I cant see a way to upload files on this forum but here is the phpinfo data from both servers....

Here is the MBSting section for the working server: 

mbstring

Multibyte Support enabled
Multibyte string engine libmbfl
HTTP input encoding translation disabled

 

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

 

Multibyte (japanese) regex support enabled
Multibyte regex (oniguruma) version 4.7.1

 

Directive Local Value Master Value
mbstring.detect_order no value no value
mbstring.encoding_translation Off Off
mbstring.func_overload 0 0
mbstring.http_input pass pass
mbstring.http_output pass pass
mbstring.http_output_conv_mimetypes ^(text/|application/xhtml\+xml) ^(text/|application/xhtml\+xml)
mbstring.internal_encoding no value no value
mbstring.language neutral neutral
mbstring.strict_detection Off

Off

 

mbstring.substitute_character no value no value

 

Here it is for the server that is not working (Ubuntu):

mbstring

Multibyte Support enabled
Multibyte string engine libmbfl
HTTP input encoding translation disabled

 

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

 

Multibyte (japanese) regex support enabled
Multibyte regex (oniguruma) backtrack check On
Multibyte regex (oniguruma) version 4.7.1

 

Directive Local Value Master Value
mbstring.detect_order no value no value
mbstring.encoding_translation Off Off
mbstring.func_overload 0 0
mbstring.http_input pass pass
mbstring.http_output pass pass
mbstring.http_output_conv_mimetypes ^(text/|application/xhtml\+xml) ^(text/|application/xhtml\+xml)
mbstring.internal_encoding no value no value
mbstring.language neutral neutral
mbstring.strict_detection Off Off
mbstring.substitute_character no value no value



There is a difference between the two but I do not know what I should change.
Any assistance here would be greatly appreciated. Many thanks again.... 

Brian 

Oct 11, 2012 at 12:37 PM
Edited Oct 12, 2012 at 11:51 AM
kseudo wrote:

Hi Mark,


Many thanks for answering my post. I still have not figured this out. I cant see a way to upload files on this forum but here is the phpinfo data from both servers....

Here is the MBSting section for the working server: 

mbstring

Multibyte Support enabled
Multibyte string engine libmbfl
HTTP input encoding translation disabled

 

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

 

Multibyte (japanese) regex support enabled
Multibyte regex (oniguruma) version 4.7.1

 

Directive Local Value Master Value
mbstring.detect_order no value no value
mbstring.encoding_translation Off Off
mbstring.func_overload 0 0
mbstring.http_input pass pass
mbstring.http_output pass pass
mbstring.http_output_conv_mimetypes ^(text/|application/xhtml\+xml) ^(text/|application/xhtml\+xml)
mbstring.internal_encoding no value no value
mbstring.language neutral neutral
mbstring.strict_detection Off

Off

 

mbstring.substitute_character no value no value

 

Here it is for the server that is not working (Ubuntu):

mbstring

Multibyte Support enabled
Multibyte string engine libmbfl
HTTP input encoding translation disabled

 

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

 

Multibyte (japanese) regex support enabled
Multibyte regex (oniguruma) backtrack check On
Multibyte regex (oniguruma) version 4.7.1

 

Directive Local Value Master Value
mbstring.detect_order no value no value
mbstring.encoding_translation Off Off
mbstring.func_overload 0 0
mbstring.http_input pass pass
mbstring.http_output pass pass
mbstring.http_output_conv_mimetypes ^(text/|application/xhtml\+xml) ^(text/|application/xhtml\+xml)
mbstring.internal_encoding no value no value
mbstring.language neutral neutral
mbstring.strict_detection Off Off
mbstring.substitute_character no value no value



There is a difference between the two but I do not know what I should change.
Any assistance here would be greatly appreciated. Many thanks again.... 

Brian 


Thanks again,

brian. 

Oct 16, 2012 at 11:22 AM

Hi again,

Has anyone out there a suggestion for me? Perhaps you have seen a similar issue?  I am not making any progress unfortunately ;(

Thanks,

Brian.