fopen(app/storage/framework/cache/data/6a/e8/6ae8f7a027ae2ffc516a3933fcade51ab014d34d): Failed to open stream: Permission denied
Stack trace
app/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:256
app/vendor/laravel/framework/src/Illuminate/Filesystem/LockableFile.php:69
app/vendor/laravel/framework/src/Illuminate/Filesystem/LockableFile.php:42
app/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php:108
app/vendor/laravel/framework/src/Illuminate/Cache/FileLock.php:14
app/vendor/laravel/framework/src/Illuminate/Cache/Lock.php:91
app/vendor/laravel/framework/src/Illuminate/Bus/UniqueLock.php:43
app/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php:164
app/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php:188
app/vendor/ssntpl/cloud-storage/src/CloudStorageAdapter.php:65
app/vendor/ssntpl/cloud-storage/src/CloudStorageAdapter.php:151
I am dispatching job app/vendor/ssntpl/cloud-storage/src/CloudStorageAdapter.php:65
job
SyncFileJob::dispatch($path, $fromDisk, $remoteDisk)->onConnection($this->connection)->onQueue($this->queue);
then sometimes that line throw above error(Failed to open stream: Permission denied) whereas sometimes it working fine.
can anyone explain me, why is it happened?
what will be the solution for it?
If there was a permission issue then not a single job would be run.
queue connection is sync
2
Answers
Its related to permissions,
if you are using linux,you can write in terminal:
sudo chmod 777 -r {directory-address}
I think in your case laravel is using the file cache driver, which stores cached data in the storage/framework/cache/data directory. if it’s possible switch from file to redis or database in config/cache.php
however you can fix this with running this command for directory permission
chmod -R 775 storage
and then run
chown -R www-data:www-data storage
//replace www-data with your web server’s user.Clear cache and restart queue workers and try again
php artisan cache:clear
php artisan queue:restart