phplaravellaravel-queuephpoffice-phpspreadsheet

laravel queue worker subdirectory


I have a laravel queue worker setup where i create a spreadsheet file with phpoffice and save it 2 levels below the root directory ../../directory_name. Saving the file works fine when i call the save method myself. but when it's called by the dispatcher in queue worker i get "Failed to open stream: No such file or directory" error. What may be the cause?

I tried changing the save directory to simply "/" this makes the job pass but the file doesn't seem to save


Solution

  • ok, i found the problem. i was trying to access ../../directory but when i start it using php artisan queue:listen the root direcotry is not the laravel's /public directory but the root "/" directory. by changing ../../ to ../ it works.