Could not find zip member laravel queues job – Laravel

huangapple go评论101阅读模式
英文:

(PhpOffice\\PhpSpreadsheet\\Reader\\Exception(code: 0): Could not find zip member laravel queues job - Laravel

问题

I have a Laravel 9 application that uses the 'maatwebsite/excel' library for Excel file export and import. It works well locally and on the server. However, when I implemented a Laravel queue job to run the import process in the background, it started giving an error on the server:

> PhpOffice\PhpSpreadsheet\Reader\Exception: Could not find zip member zip:///home/abc/public_html/storage/framework/cache/laravel-excel/laravel-excel-IBXMy3FjOUS4zPPBmdTRMctFwRMk31A5.xlsx#_rels/.rels in /home/abc/public_html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php:159

Any idea why it's not working with the queue job but works without it? Thanks.

英文:

I have application created using Laravel 9.
i have installed 'maatwebsite/excel' library to export and import excel file. it is working good on local and server.
but now i have implemented laravel queue job to run process in background. and excel import is running in background. excel import queue job is working fine on local. but on server it gives error:
>PhpOffice\PhpSpreadsheet\Reader\Exception: Could not find zip member zip:///home/abc/public_html/storage/framework/cache/laravel-excel/laravel-excel-IBXMy3FjOUS4zPPBmdTRMctFwRMk31A5.xlsx#_rels/.rels in /home/abc/public_html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php:159

>Stack trace:
#0 /home/abc/public_html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php(400): PhpOffice\PhpSpreadsheet\Shared\File::assertFile()

etc...

Any idea how is not working in queue job and working without queue?
Thanks

答案1

得分: 0

我找到了答案。对于队列作业,我们必须指定文件的完整路径。<br/>
例如,\Excel::import(new MatchingImport, '在这里指定文件的完整路径');

英文:

I found the answer. For queue jobs, we have to specify full path of the file. <br/>
e.g., \Excel::import(new MatchingImport, &#39;full_path_of_the_file_here&#39;);

答案2

得分: 0

以下是您要翻译的内容:

好的,这是对我有效的方法:

> 检查文件系统

Could not find zip member laravel queues job – Laravel

> 根据您正在使用的磁盘创建绝对文件路径

Could not find zip member laravel queues job – Laravel

> 检查调试日志输出

E:\xampp\htdocs\path1\path2\storage\app/public\contacts_csv_files/5tQMj_31_07_2023_05_50_16.xlsx  

> 重要提示:每当您对作业文件进行更改时,请确保首先停止它,然后再重新启动,因为当前的更改可能不会反映在正在进行的作业中,所以请确保首先停止它,然后再运行

php artisan queue:work
英文:

Alright so here is what worked for me

> Check filesystem

Could not find zip member laravel queues job – Laravel

> Create absolute file path based on disk that you are using

Could not find zip member laravel queues job – Laravel

> Check Debug Log Output

E:\xampp\htdocs\path1\path2\storage\app/public\contacts_csv_files/5tQMj_31_07_2023_05_50_16.xlsx  

> IMPORTANT NOTE : Every time you make changes in job file, make sure you stop it first and then restart it again, because current changes might not reflect in on-going job, so make sure to stop it first and then run again

php artisan queue:work

huangapple
  • 本文由 发表于 2023年6月13日 00:26:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76458583.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定