When attempting an Excel 97-2003 XLS Woorkbook export, one gets:
[Fri Mar 19 15:55:41 2010] [error] [client 130.238.131.137] PHP Fatal error: Uncaught exception 'Exception' with message 'Can't create temporary file' in /apache/htdocs/hotel/phpMyAdmin-3.3.1-all-languages/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_File.php:98\nStack trace:\n#0 /apache/htdocs/hotel/phpMyAdmin-3.3.1-all-languages/libraries/PHPExcel/PHPExcel/Writer/Excel5.php(190): PHPExcel_Shared_OLE_PPS_File->init()\n#1 /apache/htdocs/hotel/phpMyAdmin-3.3.1-all-languages/libraries/export/xls.php(62): PHPExcel_Writer_Excel5->save('/tmp/pma_xls_mZ...')\n#2 /apache/htdocs/hotel/phpMyAdmin-3.3.1-all-languages/export.php(568): PMA_exportFooter()\n#3 {main}\n thrown in /apache/htdocs/hotel/phpMyAdmin-3.3.1-all-languages/libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_File.php on line 98
It appears that a temporary file was created, but with zero size, listing /tmp:
-rw------- 1 web web 0 2010-03-19 15:55 pma_xls_mZmeaz
The zero size file is most probably generated by _initialize() in libraries/PHPExcel/PHPExcel/Writer/Excel5/Worksheet.php, which is called by save() in libraries/PHPExcel/PHPExcel/Writer/Excel5.php.
However, the latter function also (later) calls $OLE->init(), which in init() in libraries/PHPExcel/PHPExcel/Shared/OLE/OLE_File.php will attempt to fopen() a temporary file (not necessarily the same!). The temporary file name is composed of a tempnam() call specifying $this->_tmp_dir as the directory, but as phpMyAdmin doesn't seem to have called $OLE->setTempDir(), the directory is empty, The outcome of that is supposedly undefined (the PHP docs for tempnam() only mentions that " If PHP cannot create a file in the specified dir parameter, it falls back on the system default." which may differ, and in our case (on our platform), seems to be broken: http://bugs.php.net/bug.php?id=42560
The best way to solve this (awaiting the PHP fix for our platform) would be to make sure that phpMyAdmin calls setTempDir to make sure that the temporary directory for PHPExcel is always explicitly set to the same value as $cfg['TempDir'] of the phpMyAdmin configuration.
Attaching a diff for libraries/export/xls.php for that.
libraries/export/xls.php patch to set temporary directory
Patch merged in git, thanks for your contribution!