Category: PHP Excel

  • Warning: ZipArchive::close(): Failure to create temporary file: Permission denied in

    Warning: ZipArchive::close(): Failure to create temporary file: Permission denied in

    Warning: ZipArchive::close(): Failure to create temporary file: Permission denied in

    Fatal error: Uncaught PHPExcel_Writer_Exception: Could not close zip file

    The most common cause of this error when saving to php://output is an open_basedir restriction that doesn’t include a valid system’s temp folder (e.g. /tmp), or permissions for the system’s temp folder…  can also affect this, even when the obvious permissions appear to be set correctly.

    A possible workround is to write the file to the filesystem in a directory that you know you do have full privileges to write, and then use readfile() to stream that file to php://output before deleting the file