When I send a job that fails due to an exception such as 'ErrorException' with message 'Undefined variable: sender' and I fix the code and re-fire the event, the previous code runs again and I get the same error.
I have no idea why Laravel re-runs my old code over and over. I'd obviously like to be able to fix the mistakes that are breaking my job execution.
I've tried both composer dump-autoload and php artisan queue:flush and those have no effect. Any help?
My Laravel 5.1 config/compile.php file is empty but this helped me:
sudo service beanstalkd restart
and
php artisan queue:restart
Laravel often lacks of good and accurate documentation.
You need to run php artisan clear-compiled to clear compiled files.
If you look at config/compile.php you will see some extra providers (or other classes) are cached by default by Laravel.
If you made any changes for example in EventServiceProvider and it was earlier cached, Laravel won't see those changes in case php artisan optimize command was earlier launched (and looking at https://github.com/laravel/laravel/blob/master/composer.json you will see it is launched after running composer install or composer update).
This feature has nothing in common with composer itself but with Laravel that's why running composer dump-autoload won't help.
In my case, supervisor was the issue.
This is the only process that works consistently for me:
run 'service supervisor stop'
run 'service supervisor start'
quit your browser, restart it, clear the cache and try again
Note: running 'service supervisor restart' had no effect.
I'm using Lumen and ran into the same issue. I tried php artisan queue:restart, which did nothing. I then found this thread and tried php artisan clear-compiled, as per the winning answer, but got the error:
Command "clear-compiled" is not defined.
I then saw that Artisan had the option php artisan cache:clear, which did the trick! When I fire that command followed by php artisan queue:work, my new job code is used.
Related
This is consuming the last 2 days of my life. Locally everything is working fine but when my code is deployed to Heroku, Laravel can't find the index view. It's my understanding this is some caching issue, so I have tried most of Artisan's commands to clean the cache:
php artisan config:cache
php artisan route:cache
php artisan view:clear
php artisan clear-compiled
This is my route, I'm serving a SPA:
Route::get('/{any}', 'HomeController#main')->where('any', '.*');
And this is the stack trace on my view:
I have cleaned the bootstrap/cache folder and honestly I'm out of ideas. Does someone have a light on this one? Thanks
Please use the all around cache clearing command :
php artisan optimize:clear
I've found the solution to the same issue:
The issue itself seems to be caused by the official php buildpack, which does php artisan optimize at the end of the build process inside the build environment (aside from other things it clears and recreates the configuration cache). This causes the build directory /tmp/build_xxxxxxxx/ to be saved into the configuration cache.
The solution is to run php artisan config:clear, but it won't take effect on the already built and running app because of how heroku works: when you access their shell you perform operations on the filesystem that's generated from a project build and is destroyed as soon as you exit the shell. The operations you perform on files in that shell don't effect the running app instances. php artisan config:clear must be ran at the end of the build process.
One way to do this is the gerardbalaoro/laravel buildpack which allows adding custom hooks after the build process. Keep in mind that it also does php artisan views:clear after the build while the official php buildpack doesn't. Using it and adding LARAVEL_COMMANDS='php artisan config:clear' to heroku config solved the issue for me.
tl;dr:
heroku buildpacks:set gerardbalaoro/laravel
heroku config:set LARAVEL_COMMANDS='php artisan config:clear'
git commit --allow-empty -m 'force rebuild'
git push heroku master
I've been trawling for almost two days to find an answer, but no solutions to similar problems have helped to solve mine, so time to ask my own question.
Using Laravel 5.7 on Windows 10. When I run a php artisan make:migration command, or make a model with a migration (make:model -m), it runs fine once; the migration is created. But after that I am unable to run any further php artisan commands. Every time I try I get:
In Container.php line 779:
Class view does not exist
I've since discovered that the same issue also arises when making a seeder. I have noticed that upon running the first command, the bootstrap\cache\services.php file is being removed. Using a backup to replace this file in the directory fixes the problem, allowing me to run php artisan commands again. But the moment I make a migration or a seeder, the file is removed and I encounter the same error.
I have tried a composer dump-autoload. If the services.php file is in the directory, it gets removed again and I am shown the error.
I have tried composer update and composer install (including after removing the vendor folder)
I have tried php artisan config:cache and php artisan config:clear
I have checked my .env file for spaces not contained within quotations.
I have checked that 'Illuminate\View\ViewServiceProvider::class,' is in my config\app.php file under 'providers'.
Everything seemed to be working fine a week or so ago. I hadn't been running any php artisan commands in the interim or really working directly with my application at all during that time so I am not sure what has caused this issue to arise.
make sure to run this command:
sudo chmod 777 -R bootstrap/cache
I wanted to remove a package from laravel. I did composer remove vendor/package
It was all good on my dev, but when I deploy on production something went wrong and I cannot do anything now.
when I run
php artisan package:discover
I'm geting
In ProviderRepository.php line 208:
Class 'Laracasts\Flash\FlashServiceProvider' not found
I'm guessing I it is something to do with some kind of cache or maby config
but I cannot run this command,
php artisan config:clear
because I'm getting the same error message as above.
PS. I'm using Laravel 5.6
You may need clear the autoloader files if they get jammed up as it is looking at those cached files when php artisan config:clear runs, thus creating the jam.
Remove the following files and they will rebuild:
/bootstrap/cache/packages.php
/bootstrap/cache/services.php
I fixed my problem deleting a config file like so:
$rm bootstrap/cache/config.php
This file is basically a cache for config, if you want to have this file built for you just run a following artisan command:
$php artisan config:cache
I have changed my application by using command
php artisan app:name [app_name].
Then, when I try to perform other actions using following artisan commands,
php artisan down
php artisan up
php artisan config:cache
I got the following error:
PHP Fatal error: Class 'App\Providers\AppServiceProvider' not found
How can I solve it?
It is working after Clearing bootstrap/cache directory.
This is how its worked out for me in the case of a fresh install.
First, I cleared the files in boostrap\cache.
Then, in config\app.php, I added the below line in the providers,
\Laravel\Telescope\TelescopeServiceProvider::class,
Then I ran the below commands
php artisan telescope:install
php artisan migrate
And it was working after this.
I don't know for what reason the telescope provider didn't work which was added by Laravel itself. i.e App\Providers\TelescopeServiceProvider::class.
By the way my laravel version was 7.12.0.
In my case, some extension of the VSCode, added a use Illuminate\Support\Facades\App; at the beginning of the file /config/app.php.
I solved it by removing the line from the file and running composer install.
You might have deleted the folder called providers
App/providers.
I had a question like yours then I solved it by copying app/providers directory from another Laravel project to my project thus it worked
I had the same issue, I solved it by,
migrate migration file - vendor>laravel>telescope>database>- manually.
check app.php file, if App\Providers\TelescopeServiceProvider::class, exist or not, have to exist
Run in command shell>
npm run dev
I actually wanted to follow up on this question, but I guess It's better to start a new question.
I installed a fresh copy of my own laravel(5.0), and I tried running php artisan route:list, which works.
Now I have downloaded the compressed repository of a project I want to deploy on a shared hosting enviorment, but when I run php artisan route:list nothing happens.(No error message, nothing). Using this method for hosting the application
The actual problem is php artisan migrate, which also outputs nothing!
Is there a good method for troubleshooting this ?
Could you provide me we some points of failure that I can check ?
Worth mentioning:
I'm no Laravel developer and I have limited time reading up on it.
As LittleFinger suggested, it's possible that artisan is not actually yet installed. When deploying from a repo, Laravel's packages of which the entire framework core is composed, are not included. You should run composer install to install the packages. If you don't have composer installed that can be difficult on shared hosting, but it's usually possible to install it.
You will need to run composer install before you run composer update. Running composer update is not required, unless you want to update to the newest versions of your packages which are allowed by the rules in your composer.json file. This should be done with care in a production environment as new versions of packages could break your app.
Once you've installed the packages, you'll need to set your environment variables (database credentials etc.) by copying the .env.example file to .env and editing it. Once you've done this you'll be able to run php artisan key:generate to generate an encryption key.
After this, your app should work (assuming you've pointed a domain to the /public directory).
I am facing the same issue when I try to run
php artisan migrate or php artisan cache:clear
nothing happen just a blank screen no success no error see the screenshot
after debugging I found a message in error_log in root directory which says.
Fatal Error: Allowed Memory Size
after increasing the memory php artisan commands works fine