Class 'XMLWriter' not found

Topics: Developer Forum
Dec 21, 2007 at 11:23 AM
hello


I have the errors

12:16:26 Create new PHPExcel object 12:16:26 Set properties 12:16:26 Add some data 12:16:26 Rename sheet 12:16:26 Write to Excel2007 format
Fatal error: Class 'XMLWriter' not found in /home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export/Classes/PHPExcel/Shared/XMLWriter.php on line 62

when I try 01simple.php example and

Warning: tempnam() function.tempnam: openbasedir restriction in effect. File() is not within the allowed path(s): (/home/www/68afc86ce58286d751238a5ae9b8de61:/tmp:/opt/php/lib/php) in /home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export/Classes/PHPExcel/Shared/OLE/OLEFile.php on line 87

Fatal error: Uncaught exception 'Exception' with message 'Can't create temporary file' in /home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export/Classes/PHPExcel/Shared/OLE/OLEFile.php:90 Stack trace: #0 /home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export/Classes/PHPExcel/Writer/Excel5/Workbook.php(573): PHPExcelSharedOLEPPSFile->init() #1 /home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export/Classes/PHPExcel/Writer/Excel5/Workbook.php(541): PHPExcelWriterExcel5Workbook->storeOLEFile() #2 /home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export/Classes/PHPExcel/Writer/Excel5/Workbook.php(225): PHPExcelWriterExcel5Workbook->storeWorkbook() #3 /home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export/Classes/PHPExcel/Writer/Excel5.php(240): PHPExcelWriterExcel5Workbook->close() #4 /home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export/Tests/14excel5.php(33): PHPExcelWriterExcel5->save('/home/www/68afc in /home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export/Classes/PHPExcel/Shared/OLE/OLE_File.php on line 90

when I try 14excel5.php


I understood that it's an open_basedir restrictions but how can I fix that (i use a shared hosting)
open_basedir = /home/www/68afc86ce58286d751238a5ae9b8de61:/tmp:/opt/php/lib/php

Check Excel5 writer's setTempDir() method, this is introduced to specify an alternative temp location. I guess this should solve your problem.
=> i tried like this

_public function setTempDir($pValue = '/home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export') {
if (is_dir($pValue)) {
$this->_tempDir = $pValue;
} else {
throw new Exception("Directory does not exist: $pValue");
}
}_

but it doesn't work


have you an idea to solve this ?


thank you
Coordinator
Dec 24, 2007 at 12:01 PM
I assume you have coded the following:

$writer = new PHPExcelWriterExcel5();
$writer->save(...);

Make this like the following:
$writer = new PHPExcelWriterExcel5();
$writer->setTempDir($pValue = '/home/www/68afc86ce58286d751238a5ae9b8de61/web/intranet/fonctions/export');
$writer->save(...);
Jan 3, 2008 at 4:59 PM
thank you, it works
Jan 3, 2008 at 5:01 PM
thank you, it works


and thank you for your job, phpexcel is very usefull !