Laravel Failed to open stream error with Sail - laravel

I'm attempting to run Sail within my Laravel project and it all starts as expected but when I go to https://localhost I get an error 500 in the browser and this error in the log
PHP Fatal error: Uncaught ErrorException: file_put_contents(/home/harry/booker/storage/framework/views/31194b376a867d7e5a56653be65b2bc7a5c4040b.php): Failed to open stream: No such file or directory in /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:187
I know the directory /storage/framework/views exists as I can see it in my code editor. I've tried deleting my bootstrap/cache/config.php, running php artisan config:clear && php artisan config:cache but with no luck? The bootstrap config.php file has the correct reference to the views folder. I've also made sure the permissions are correct by running sudo chmod -R 755 storage/

You mention the /storage/framework/views directory exists, but does it contain the requested file 31194b376a867d7e5a56653be65b2bc7a5c4040b.php?
Also, can you try running the following in your terminal:
php artisan optimize:clear
php artisan view:cache
This should empty all Laravel caches and rebuild the views cache.

Related

Please provide a valid cache path error in Laravel 9

I'm working with Jetstream library with Laravel 9, And I've deleted the storage folder by the wrong, and then it shows the following error.
Please provide a valid cache path.
What should I do? I tried the command composer install, and I faced the same error! So how can I return back to the storage folder?
create the following
storage/app
storage/app/public
storage/framework
storage/framework/cache
storage/framework/cache/data
storage/framework/views
storage/framework/session
storage/logs
And use git to manage your code so that accidents like this are easily recovered
Open your terminal.
Run cd YOUR_LARAVEL_PATH to navigate to the Laravel directory.
Run mkdir storage/framework/{cache,sessions,views} to create missing directories.
Run php artisan cache:clear
Run php artisan config:clear
Run php artisan view:clear
Run chmod -R 777 storage to set write permissions (depends on your system).

Laravel 8 permission denied in shared hosting

I have my laravel 8 app hosted in hostinger hpanel but for hours I have trying to fix this error.
UnexpectedValueException There is no existing directory at "There is no existing directory at "/Users/macbookpro/Documents/Theodory/projectName/storage/logs" and it could not be created: Permission denied" and it could not be created: Permission denied missing folder is from my machine instead of cpanel path.
I have tried find and delete ../bootstrap/cache/config.php but there is no such a file and I have tried to delete all storage/logs but am still getting that error and I have tried to add manually in web.php
Route::get('/optimize',function(){
Artisan::class('optimize:clear');
});
But when I hit /optimize am still getting the same error.
I have decided to use hostinger ssh so that I can be able to run artisan commands but am still getting same error even after hitting artisan commands successful.
What can I make it work in hostinger hpanel to which is similar to traditional cpanel.
try the following commands and hit again /optimize
php artisan route:clear
php artisan config:clear
php artisan cache:clear
try these artisan commands
php artisan optimize:clear
after that, you should run this command
php artisan optimize
you are facing this issue because your application doesn't have proper permissions for the storage directory.
Use this command to grant required permissions to the storage directory, and this should resolve the issue.
chmod 777 -R storage/

Accidentally deleted laravel.log from Laravel 8; now, the engine wouldn't populate the it with error messages

I wanted to free up the space stored in laravel.log under storage\logs. But when I did, it stopped working, and so I manually removed the laravel.log into the trash bin hoping that laravel would generate a new log file, but it didn't. So, I created a new laravel.log manually. I ran php artisan config:cache and php artisan view:clear to help solve this issue.
Without having to reinstall the whole thing, are there ways to fix this?
To resolve in Windows 10:
Navigate to your project directory, to storage\logs and create a file called laravel.log
Then run php artisan view:clear and php artisan config:cache
deleting storage/logs/laravel.log shouldn't create any issue, you can recreate the file by the name of laravel.log then add permission to the log file (in ubuntu) by running sudo chmod -R a+rwx /var/www/html/appplication-name/storage/logs and then run php artisan cache:clear, php artisan config:cache.

Laravel ErrorException No such file or directory

I have uploaded my Laravel project on ubuntu server via putty terminal.
Composer installed on server machine but when i run any artisan command it gives an error.
$ php artisan serve
ErrorException
require(/var/www/html/healthapi.fynity.in/routes/api/v1/api.php): failed to open stream: No such file or directory
The api.php is already there but i don't know why this error comes. Tried all the solutions from google.
Problem:
You may have changed something earlier such as the name or the path of the file.
Solution:
First of all, you use the following command to clear all configs.
$ php artisan config:clear
Then, you run again the following command.
$ php artisan serve
Update (2021/01/07):
You got the following error:
ErrorException require(/var/www/html/healthapi.fynity.in/routes/api/v1/api.php): failed to open stream: No such file or directory at vendor/laravel/framework/src/Illuminate/Routing/RouteFileRegistrar.php:35 31
It seems that the library is not fully installed. You should update the library with the following command:
$ composer update
Then, you run again the following command:
$ php artisan serve

Protocol error in Laravel

I am using Laravel 5.6.23
This is my error message:
UnexpectedValueException
There is no existing directory at "C:\timereg-project\Laravel\storage\logs" and its not buildable: Protocol error
The directory logs do in fact exist in my Laravel project.
I have tried this which is not working:
php artisan cache:clear
php artisan clear-compiled
I have tried this which is also not working:
composer dump-autoload
If I try this:
sudo chmod -R 777 storage
sudo chmod -R 777 storage
I get error
chmod: cannot access 'Laravel/storage/logs': no such file or directory
Commands which is not working:
composer update
What can i do about this? It feels like i am totally blocked from the logs folder.
If all is set correctly and permissions it should work. Try this command you missed:
php artisan config:clear

Resources