Temp files not being cleaned up when writing sheet to disk

Topics: Developer Forum, User Forum
Aug 13, 2014 at 5:42 PM
PHP 5.3.27
PHPExcel 1.7.9
Windows 7, 64-bit

I have the following code:
PHPExcel_Settings::setZipClass( PHPExcel_Settings::PCLZIP );

$filename = "my_file_" . date( "Ymd_His" ) . ".xlsx";
$objWriter = new \PHPExcel_Writer_Excel2007( $objPHPExcel );
$objWriter->setPreCalculateFormulas( false );
$objWriter->setUseDiskCaching( true, sys_get_temp_dir() );
$objWriter->save( "$dir/$filename" );
$objPHPExcel->disconnectWorksheets();
unset( $objWriter, $objPHPExcel );
The file is created properly, but the temp files are left behind. There are warnings like this in the logs:
E_WARNING unlink(C:\Windows\Temp\xmlC47.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xmlC58.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xmlC68.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xmlC79.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xmlC7A.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xmlC8A.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xmlCAB.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xmlF5A.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xmlFD8.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xmlFD9.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
E_WARNING unlink(C:\Windows\Temp\xml5A51.tmp) [<a href='function.unlink'>function.unlink</a>]: Permission denied at C:\code\vendorlink\vl\dev\docroot\app\includes\phpexcel\PHPExcel\Shared\XMLWriter.php:91
Any ideas why unlink would have permission denied?

Thanks for your help.