Supervisor I've got a problem. I was following the new series about setting up a server for a Laravel app deployment and I didn't isolate my app because I don't intend to deploy another app on the same server. I tried to set up supervisor to keep my workers running, the problem is that they aren't able to pick any jobs. I've created and pointed the log file at /var/www/my-app/storage/logs/workers.log. I'm getting this error in the database from the jobs that are failing:
ErrorException: file_put_contents(/var/www/biblewordle/storage/framework/views/03cfccecd1a77f600dbbf1cb0c8f37e3a28a817d.php): Failed to open stream: Permission denied in /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:190
Stack trace:
#0 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(270): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()
#2 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(190): file_put_contents()
#3 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(185): Illuminate\Filesystem\Filesystem->put()
#4 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(62): Illuminate\View\Compilers\BladeCompiler->compile()
#5 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\View\Engines\CompilerEngine->get()
#6 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\View\View->getContents()
#7 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\View\View->renderContents()
#8 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php(65): Illuminate\View\View->render()
#9 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(334): Illuminate\Mail\Markdown->render()
#10 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(304): Illuminate\Mail\Mailable->buildMarkdownView()
#11 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(204): Illuminate\Mail\Mailable->buildView()
#12 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php(19): Illuminate\Mail\Mailable->Illuminate\Mail\{closure}()
#13 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(213): Illuminate\Mail\Mailable->withLocale()
#14 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(309): Illuminate\Mail\Mailable->send()
#15 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(253): Illuminate\Mail\Mailer->sendMailable()
#16 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php(124): Illuminate\Mail\Mailer->send()
#17 /var/www/biblewordle/app/Jobs/ReportBug.php(38): Illuminate\Mail\PendingMail->send()
#18 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\ReportBug->handle()
#19 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#20 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#21 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#22 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/Container.php(661): Illuminate\Container\BoundMethod::call()
#23 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()
#24 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#25 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#26 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#27 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(124): Illuminate\Bus\Dispatcher->dispatchNow()
#28 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()
#29 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#30 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(126): Illuminate\Pipeline\Pipeline->then()
#31 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#32 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()
#33 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(425): Illuminate\Queue\Jobs\Job->fire()
#34 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(375): Illuminate\Queue\Worker->process()
#35 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(173): Illuminate\Queue\Worker->runJob()
#36 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(148): Illuminate\Queue\Worker->daemon()
#37 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(131): Illuminate\Queue\Console\WorkCommand->runWorker()
#38 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#39 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#40 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#41 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#42 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Container/Container.php(661): Illuminate\Container\BoundMethod::call()
#43 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call()
#44 /var/www/biblewordle/vendor/symfony/console/Command/Command.php(312): Illuminate\Console\Command->execute()
#45 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Console/Command.php(153): Symfony\Component\Console\Command\Command->run()
#46 /var/www/biblewordle/vendor/symfony/console/Application.php(1022): Illuminate\Console\Command->run()
#47 /var/www/biblewordle/vendor/symfony/console/Application.php(314): Symfony\Component\Console\Application->doRunCommand()
#48 /var/www/biblewordle/vendor/symfony/console/Application.php(168): Symfony\Component\Console\Application->doRun()
#49 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\Component\Console\Application->run()
#50 /var/www/biblewordle/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\Console\Application->run()
#51 /var/www/biblewordle/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#52 {main}
Tried some commands like these
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
sudo PHP artisan optimize:clear
but they didn't work for me. Can you help me?
The error message suggests that the worker is unable to write to the storage directory due to permission issues. The following steps can be taken to resolve the issue:
Check the ownership and permissions of the storage directory. The ownership should be set to the web server user (usually www-data) and the permissions should be set to 775.
sudo chown -R www-data:www-data /var/www/my-app/storage
sudo chmod -R 775 /var/www/my-app/storage
Check the ownership and permissions of the bootstrap/cache directory. The ownership should be set to the web server user (usually www-data) and the permissions should be set to 775.
sudo chown -R www-data:www-data /var/www/my-app/bootstrap/cache
sudo chmod -R 775 /var/www/my-app/bootstrap/cache
Restart the supervisor service to ensure that the changes take effect.
sudo service supervisor restart
Run the php artisan config:cache command to clear the configuration cache.
php artisan config:cache
Run the php artisan queue:restart command to restart the queue workers.
php artisan queue:restart
These steps should resolve the permission issues and allow the workers to pick up jobs.
Tried the instructions above but they didn't work either =(
I decided to rebuild the server and redid all the deployment steps from scratch but this time I followed the steps to isolate the app. Now I'm getting the error "Call to undefined function mb_strcut()".
The app is hosted on an ubuntu server with nginx. I installed the extension by running the command "sudo apt install php8.1-mbstring" and restarted nginx and PHP services, but I'm still getting the same error. I'm running jobs through the database, not Redis. Could this be the issue? My env file is also set to use the database
@Antonio Orlando make sure you restart php-fpm and any workers
@Snapey I installed Redis and I was still getting failing jobs. I was about to redo everything until I saw your message. I restarted php-fpm service AND the workers with the command php artisan queue:restart, dispatched a new job and it's finally working! Thanks for your help!
Please sign in or create an account to participate in this conversation.