Ever got a "Could not close zip file" when using PHPExcel Writer?
Usually the full error message is something like
This is caused because the PHPExcel requires access to the /tmp directory but the apache configuration is not allowing it.
The solution is easy and fast, just add the /tmp to your php_admin_value open_basedir parameter, as in this example:
When using EHCP, it is recommended to update the Virtualhost configuration in all your templates (apachetemplate, apachetemplate_ipbased, apache_subdomain_template, apache_subdomain_template_ipbased) located in /var/www/new/ehcp:
./M6
[exception.PHPExcel_Writer_Exception] exception 'PHPExcel_Writer_Exception' with message 'Could not close zip file php://output.' in /var/www/vhosts/yourdomain/phpexcel/Classes/PHPExcel/Writer/Excel2007.php:399
This is caused because the PHPExcel requires access to the /tmp directory but the apache configuration is not allowing it.
The solution is easy and fast, just add the /tmp to your php_admin_value open_basedir parameter, as in this example:
php_admin_value open_basedir "[your current paths]:/tmp"
When using EHCP, it is recommended to update the Virtualhost configuration in all your templates (apachetemplate, apachetemplate_ipbased, apache_subdomain_template, apache_subdomain_template_ipbased) located in /var/www/new/ehcp:
php_admin_value open_basedir "{homedir}:/usr/share/php:/usr/share/pear:/tmp"
./M6