Learn why this exception is thrown during the creation of an excel file with PHPExcel.

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 !


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.

Sponsors