Skip to content

Cannot save/write file #1663

@JulyanoF

Description

@JulyanoF

When I try to save file of document, I get this error:
Warning: ZipArchive::close(): Failure to create temporary file: Permission denied in vendor/phpoffice/phpword/src/PhpWord/Shared/ZipArchive.php on line 163
My code is this:

require 'vendor/autoload.php';
$html = file_get_contents('template.html');
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, false, false);
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('test.xlsx');

I'm running in Ubuntu 18.04 x64 PHP 7.2 and this project is inside apache's folder (/var/www/html/myproject).
I already tried to change entire folder permissions to 0755 and owner to www-data:www-data and myuser:www-data and I got same error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions