Question

Could not close zip file php://output

  • Posted November 7, 2013

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

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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…

@jelwin: zPanel does not allow scripts to write to /tmp. You have to modify your script so that it writes to <code> /var/zpanel/temp/</code> instead.

I am also having the same problem <br> <br>When I am trying to export data I am getting an error “Could not close zip file php://output. <br>See also ‘System > Error Logs’ for more details.” <br> <br>[b]My error Log: -[/b] <br>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 <br>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 <br>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 <br> <br>I am using Zpanel . <br> <br>[b]My server Details[/b] <br>Server OS: Ubuntu <br>Apache Version:2.2.22 <br>PHP Version:5.3.10-1ubuntu3.8 <br>MySQL Version:5.5.32-0ubuntu0.12.04.1 <br>ZPanel Version:10.1.0 <br> <br>temp folder have write permissions (777) <br>Also added temp folder in php.ini <br> <br>PHP INFO:- <br> <br>Zip enabled <br>Extension Version $Id: php_zip.c 321634 2012-01-01 13:15:04Z felipe $ <br>Zip version 1.9.1 <br>Libzip version 0.9.0 <br> <br>Can anybody help in this issue? <br> <br>

What directory are you trying to write to?

I add this to my php.ini, open_basedir = /tmp <br> <br>but error is still there

You have to add /tmp to your ‘open_basedir’ setting in the php.ini. <br> <br>Check the documentation: http://php.net/open-basedir