robvds
By:
robvds

Could not close zip file php://output

November 7, 2013 10k views
I have this error since I transferred my website to digital ocean VPS. I want to export a file, this file will be saved on my computer, but it is not working anymore because I have this error. I checked the /tmp and /var/zpanel/temp directory, but they have full rights. Logging from my opencart: 2013-11-07 9:49:30 - PHP Warning: realpath(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/zpanel/hostdata/zadmin/public_html/domain_com:/var/zpanel/temp/) in /var/zpanel/hostdata/zadmin/public_html/domain_com/system/PHPExcel/Classes/PHPExcel/Shared/File.php on line 136 2013-11-07 9:49:30 - PHP Warning: tempnam(): open_basedir restriction in effect. File() is not within the allowed path(s): (/var/zpanel/hostdata/zadmin/public_html/domain_com:/var/zpanel/temp/) in /var/zpanel/hostdata/zadmin/public_html/domain_com/system/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php on line 205 2013-11-07 9:49:35 - PHP Exception: Could not close zip file php://output. in /var/zpanel/hostdata/zadmin/public_html/domain_com/system/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php on line 378
6 Answers
You have to add /tmp to your 'open_basedir' setting in the php.ini.

Check the documentation: http://php.net/open-basedir
I add this to my php.ini, open_basedir = /tmp

but error is still there
What directory are you trying to write to?
I am also having the same problem

When I am trying to export data I am getting an error "Could not close zip file php://output.
See also 'System > Error Logs' for more details."

[b]My error Log: -[/b]
2013-11-23 3:16:21 - PHP Warning: realpath(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/zpanel/hostdata/zadmin/public_html/domain_com:/var/zpanel/temp/) in /var/zpanel/hostdata/zadmin/public_html/domain_com/system/PHPExcel/Classes/PHPExcel/Shared/File.php on line 136
2013-11-23 3:16:21 - PHP Warning: tempnam(): open_basedir restriction in effect. File() is not within the allowed path(s): (/var/zpanel/hostdata/zadmin/public_html/domain_com:/var/zpanel/temp/) in /var/zpanel/hostdata/zadmin/public_html/domain_com/system/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php on line 205
2013-11-23 3:16:21 - PHP Exception: Could not close zip file php://output. in /var/zpanel/hostdata/zadmin/public_html/domain_com/system/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php on line 378

I am using Zpanel .

[b]My server Details[/b]
Server OS: Ubuntu
Apache Version:2.2.22
PHP Version:5.3.10-1ubuntu3.8
MySQL Version:5.5.32-0ubuntu0.12.04.1
ZPanel Version:10.1.0

temp folder have write permissions (777)
Also added temp folder in php.ini

PHP INFO:-

Zip enabled
Extension Version $Id: php_zip.c 321634 2012-01-01 13:15:04Z felipe $
Zip version 1.9.1
Libzip version 0.9.0

Can anybody help in this issue?

@jelwin: zPanel does not allow scripts to write to /tmp. You have to modify your script so that it writes to /var/zpanel/temp/ instead.
Make sure the drive you're trying to save to isn't full. I wish I'd seen that suggestion before this never-ending morning...
Have another answer? Share your knowledge.