I have a problem with my project laravel 5.7. I have developed it locally and all is well but once sent to my server online I have this error: view [auth.login] not found.
Ran into the same problem. I noticed three things;
A message while booting homestead about virtualbox guest-tools being out of sync between host and guest. There could be a problem with paths. I fixed that issue with the help of this here
The Laravel view [auth.login] not found on server page displayed the path of the host machine and not of the vagrant-guest.
bootstrap/cache/config.php also displayed paths from the host and not the guest.
Renaming/deleting (or artisan cache:clear) the config.php only gave errors (Laravel Error “Unable to load the ”app“ configuration file”).
I fixed the issue by correcting the paths in config.php manually to the correct path in vagrant.
Run following commands on your server.
it might solve your problem.
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan route:cache
php artisan optimize
or
composer dump-autoload -o
if you are in develop mode you can run:
php artisan config:clear
or if you are in product mode you can run:
php artisan config:cache
notice: when you use second, config clear and cache again and you force to repeat command for other changes.
I was trying to troubleshoot a Laravel issue by clearing cache and dump auto load and updating composer.json file and now when I navigate to my server I get all of these errors. The error before was boostrap cache had wrong permissios so I did sudo chmod -R 775 bootstrap/cache to fix that issue but now I have a bunch of other errors.
UPDATE: route list is as follows: photo
This command worked on my issue:
php artisan config:cache
In the Laravel doc it says that laravel by default is configured to use file cache driver which stores cached objects in filesystem, so it is necessary to recache filesystem. this is because after clearing the cache laravel doesn't know of which view to fetch from cache although you have cleared it. so after config:cache it tells to laravel to recache the new views and to available it to show. Hope it will help.
Change mode to 777 and after that run commands: php artisan config:clear && php artisan config:cache && php artisan cache:clear. Then if bootstrap/cache/config.php was not deleted then delete it also and try again.
It will work fine.
I have created(installed composer create-project laravel/laravel basicwebsite) project named basicwebsite.
After that i run php artisan serve then it showed some URL then i got LARAVEL page in browser,fine.
(Accidentally, my system is shut down.)
To reopen the project ,in cmd prompt i just did as
php artisan serve
and the error occur is
I almost searched for solution in all websites(including stack) .All started with create project but not what to do after close and opened the project.
Thanks in advance.
Use php artisan config:clear command to clear cache. You should see
Configuration cache cleared
Use php artisan serve command to start the server.
I have a project on Laravel 5 and I work with it at the office and at home too. It works fine, but recently at home it stopped working. Laravel show me two ErrorException
file_put_contents(G:\project\storage\framework\views/751d8a0fd8a7d4138c09ceb6a34bb377aa2d6265.php):
failed to open stream: No such file or directory
and
file_put_contents(G:\project\storage\framework/sessions/aIXycR4LIAUBVIqZu0T590paOMIpV8vfZGIroEp0):
failed to open stream: No such file or directory
I'm searching problem decision with Google and find information about correct rights. All advice is about Linux, but I'am work in Windows at the office and at home too.
When I try to clear application cache and view cache, artisan talk to me - ...cleared. But cache data and views are present in storage.
How can I fix this problem?
The best way to solve this problem is, go to directory laravel/bootstrap/cache and delete config.php file. or you can rename it as well like config.php.old
And your problem will be fixed.
You should typically run the php artisan config:cache command as part of your production deployment routine. As a solution to your problem, I suggest you recreate the cache file, for faster configuration loading.
To do this, run the following Artisan commands on your command line
php artisan cache:clear
php artisan config:cache
You can programmatically execute the command by adding the following to your routes:
Route::get('/clear-cache', function() {
$exitCode = Artisan::call('cache:clear');
$exitCode = Artisan::call('config:cache');
return 'DONE'; //Return anything
});
And then call the clear-cache route from your browser.
After some research I understand - I have very similar, but different root project locations and its cached in /bootstrap/cache. After cache clearing project started.
Actually I faced this issue when I moved my project from server to local.
in
storage/framework
four basic folders are required cache, sessions, testing, views
In My case sessions was missing might be in gitignore.
So I manually created session folder and refreshed browser and it was working.
So any of the missing folder if we delete this problem can be solved.
I solved this problem via creating storage\framework\sessions folder.
Apache + WSL on windows
This is a silly mistake, and a different answer compared to the others, but I'll add it because it happened to me.
If you use WSL (linux bash on windows) to manage your laravel application, while using your windows apache to run your server, then running any caching commands in the wsl will store the linux path rather than the windows path to the sessions and other folders.
Solution
Simply run the cache clearing commands in the powershell, rather than in WSL.
$ php artisan optimize
Was enough for me.
This type of issue generally occurs while migrating one server to another, one folder to another. Laravel keeps the cache and configuration (file name ) when the folder is different then this problem occurs.
Solution Run Following command:
php artisan config:cache
https://laravel.com/docs/5.6/configuration#configuration-caching
Try with these commands that have been useful with those errors
path\project\storage\framework\views...
php artisan view:clear
path\project\storage\framework/sessions...
php artisan config:cache
I deleted the file /public_html/bootstrap/cache/config.php
Then I ran php artisan config:cache
In case of shared hosting when you do not have command line access simply navigate to laravel/bootstrap/cache folder and delete (or rename) config.php.
This happens when you shift your website from local to live server or vice versa.
Simply go to bootstrap/cache and delete config.php.
The reason is related to cache or permission.
Firstly, go to directory laravel/bootstrap/cache and delete all files from cache.
php artisan cache:clear
php artisan config:clear
php artisan config:cache
If the errors still happen. It may relates to permission
Let's try command below (In my case user&group of laravel is nginx)
sudo chgrp -R nginx storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
If you are running laravel inside docker then access its filesystem
$ docker exec -it name-of-laravel-container /bin/bash
Next navigate to your laravel projects root directory. Make sure that you have inside storage/framework folder:
cache
sessions
testing
views
And they should be both readable and writable.
If nothing work try the following in the production environment
1-
composer install --optimize-autoloader --no-dev
2-
php artisan cache:clear
3-
php artisan config:clear
4-
php artisan view:clear
5-
php artisan config:cache
6-
php artisan route:cache
Works for me
Changing name of /bootstrap/cache/config.php to config.php.old doesn't work for me
neither clearing cache with the commands artisan
php artisan config:clear
php artisan cache:clear
php artisan config:cache
And for some weird reason I can't change permission for the owner on the directories, so my solution was running my IDE (Visual Studio Code) as admin, and everything works.
My project is in an F:/ path of another disk.
The reason for this problem is the cache files in localhost. According to that I've tried several things as follows to clear the cache on my project, but every time I've failed.
Tried to clear cahe commands by changing web.php file (with artisan codes)
Tried to clear cache by connecting SSH (via PUTTY)
Tried to host my project in Sub domain within create a new Public directory
So I've found a solution for this problem after each and every above steps failed and it worked for me perfectly. I deleted the cache.php file in host_route/bootstrap/cache directory.
Maybe there is an issue with your composer file. You could try:
composer install installs the vendor packages according to
composer.lock (or creates composer.lock if not present),
composer update always regenerates composer.lock and installs the
lastest versions of available packages based on composer.json
composer dump-autoload won’t download a thing. It just regenerates
the list of all classes that need to be included in the project (autoload_classmap.php). Ideal for when you have a new class inside your project. Ideally, you execute composer dump-autoload -o , for a
faster load of your webpages. The only reason it is not default, is because it takes a bit longer to generate (but is only slightly noticeable)
source
In my case it was not anything that could be fixed with php artisan commands. The issue was folder permissions for the /storage folder. The error did not make that clear.
The solution that worked for me is to just serve the app as admin
if you are
On mac or linux use sudo php artisan serve
On Windows try to open CMD as an adminstrator and then go to project directory and run php artisan serve
Clearing the contents of storage/framework/cache did the trick for me.
I had similar problems because of .gitignore for the /storage folder on first machine, then cloned repository on second machine and laravel was revision to write down sessions cache
So, manually creating folder /storage/sessions might be an solution..
This did the magic for me. chmod -Rf 0777 storage
In my case, I set APP_DEBUG=false since it is a production server, I decided to set it back to true and then it showed Missing BC Math or GMP extension
That is how I solved my own issue, setting APP_DEBUG=true might not work for everybody.
I used Laravel 8, This is my solution:
Goto:
storage/framework/cache/data
set permission directory data is 777
I went all the way, but I did not get the answer.
I just rename cache folder in storage/framework/ to cache1 and solved my problem.
I solved it clearing the content of:
/laravel/storage/framework/views
Then all the views were created again in that folder.
In my case these commands didn't fix it:
php artisan view:cache
php artisan route:cache
php artisan config:cache
I'm using Laravel 8 and in my case it seems that it was an issue with the permissions.
I am trying to setup a deployment script for my Laravel 5 app to use with CodeShip but I am having issues with clearing the application cache during the deployment.
By running
php artisan cache:clear
it does not give any errors and says the cache has been cleared but it hasnt, then when I ssh into the box and try to delete the cache manually it says permission is denied, so I need to use sudo which is not ideal as Id like to have this all to run without my intervention. I know this is a permissions issue but I cannot work out a way around it.
Is there a way I can do this or maybe a slightly different method?
You shouldn't delete cache manually. Try to run these commands:
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear
composer dump-autoload
Try php artisan config:cache
This will do it all for you.
Hope this helps!