laravel install getting key generate error in ubunto OS - laravel

I am install "Laravel Framework version 5.2.26" but i am getting error for key generate in my ubuntu os
user#CN43:/var/www/html/laravel_1$ php artisan key:generate
[ErrorException]
file_get_contents(/var/www/html/laravel_1/.env): failed to open stream: No
such file or directory
So i have check that directory .env file is not there but .env.example file only there so i created that file and update database name, database username, database password after that "php artisan key:generate" command is worked that key was generated above 32 characters and its get [base64:somethingsstrings with above 32 characters] i think some installation issues is there.
my laravel site is not opening. what i do mistake?

Rename .env.example to .env and fill all properties.
If you install Laravel via Composer, this file will automatically be
renamed to .env. Otherwise, you should rename the file manually
https://laravel.com/docs/5.0/configuration#environment-configuration

Run this command and make .env file from .env.example file:
cp .env.example .env
php artisan key:generate
Now it's generate the key. Don't create new .env file.

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 Failed to open stream error with Sail

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.

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.

Could not open input file: artisan when running php artisan serv

I'm trying to run an existing laravel project in my new windows.
when I try
php artisan serv
in my project directory, it says
Could not open input file: artisan
I even updated composer
how to configure my old project anyway?
Please run proper command on laravel project root directory:
php artisan serve

I have downloaded laravel project but it has no artisan file in root directory

I have downloaded laravel project from friends website but it has no artisan file in the root directory.
When I run php artisan list it gives an error:
could not open input file: artisan
Just pull it from here, and test with php artisan
You can't use php artisan if you are not inside your downloaded Laravel project folder. That is why you got an error could not open input file artisan
Go to your project directory using cd command in your command prompt For example: cd YourProjectName, Now you will be able to run php artisan list or php artisan it will display you list of all available commands.
NOTE: If you need Laravel installation then don't download the project on other websites. Always prefer the official document for installation.

Resources