Preloader
PHP
  • Estimated reading time: 1 Minute

How to solve PHPExcel fatal error: Uncaught exception 'PHPExcel_Writer_Exception' with message 'Could not close zip'

This exception is basically generated when PHPExcel is unable to write to the specified file or write to the directory that will contain the file, so to troubleshoot this problem you may want to follow these steps:

  1. Check that the directory that you are trying to write exists. You may do this with a tool, via CLI or even with a conditional statement in PHP.
  2. Permissions problems. If the file exists, check if the user that executes the script has access to the directory where the file should be written to (have the open_basedir in count).
  3. Block issue when the file has been opened by another application.
  4. Disk space problem, if the disk that you are tryng to write the file doesn't have available space, you will be unable to create the file.

Is important that you follow the steps in the given order until you find out what's the reason why the file cannot be created.

Happy coding !

Share:
Carlos Delgado

Carlos Delgado

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Related articles
Weekly trending
7 Top International IPTV Services Worth Trying in 2026
11 Jun, 2026
  • Estimated reading time: 11 Minutes
Top 2026 Guide to Multi Face Swap Video Creation for Beginners
11 Jun, 2026
  • Estimated reading time: 7 Minutes
Odoo ERP for Construction Companies
11 Jun, 2026
  • Estimated reading time: 4 Minutes
Best Storage Units Dubai Offers with Secure Self Storage Services
10 Jun, 2026
  • Estimated reading time: 7 Minutes
Our Sponsors

Our blog is proudly supported by industry-leading sponsors.