ZipArchive :: close():无法在AWS EC2 Linux中创建临时文件

151*_*291 8 php linux amazon-ec2 amazon-web-services phpexcel

我正在laravel 5.2中处理cron作业,当我尝试从计划调用控制器功能时创建excel表获取错误.但在邮递员中运行良好.

ZipArchive::close(): Failure to create temporary: No such file or directory' in /var/www/html/Expenses/vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007.php:398

zipArchive的临时文件权限问题?

我将phpexcel表保存到目录(777)时出现上述错误.

$excel_path = 'SubmittedSheets/'.$userId.'-'.uniqid().'.xlsx';
$objWriter->save($excel_path);
Run Code Online (Sandbox Code Playgroud)

151*_*291 5

需要绝对路径以在适用于PHPExcel的AWS Ec2 Linux中保存excel文件。

$excel_path = '/var/www/html/MyProject/public/SubmittedSheets/'.$userId.'-'.uniqid().'.xlsx';
$objWriter->save($excel_path); 
Run Code Online (Sandbox Code Playgroud)