I have both .env and .env.example file in root but still throwing error,Please help me
This exception has nothing to do with .env file. Is simply says that your program can not find Dotenv\Loader class.
Try to run composer update then composer dump commands.
Related
In Laravel 6 Documentation second paragraph of Application Key written like this
Typically, this string should be 32 characters long. The key can be
set in the .env environment file. If you have not renamed the
.env.example file to .env, you should do that now. If the application
key is not set, your user sessions and other encrypted data will not
be secure!
Why did they ask to rename it? I also found this paragraph in the Laravel older version. Is there any difference between those since they have the same content but different name?
If you've install Laravel using composer command.
composer create-project laravel/laravel projectname
you don't need renamed the .env.example file to .env. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the php artisan key:generate command.
If you clone project using git clone some folder is ignored by git so you might not get env file as well as vendor folder. Therefore, they will have to manually enter php artisan key:generate for their app to function correctly.
More info SO answer
Laravel need to use .env file to define a database connection, some general setting like application key as well. So if you have no .env file, your Laravel has not a setting for now.
Like they said, If the application key is not set, your user sessions and other encrypted data will not be secure! You need to create / copy /remove the .env.example to the new .env for this reason. for letting our Laravel knows about general config.
By the way, do not use the .env.example like copy-and-paste because it's an example. you need to change the value config to your own.
The simplest way is move it on your server with Filezilla or another FTP program. Rename file, and re-download it on your computer. It works for me last time :)
The .env.example the file is just an example of the .env file. It is not used by the app. It is used to serve as a base for you to edit and rename.
In a fresh Laravel installation, the root directory of your application will contain a .env.example file. If you install Laravel via Composer, this file will automatically be renamed to .env. Otherwise, you should rename the file manually.
i just installed Laravel (throught composer):
OS - Windows 8;
Local Server - Open Server;
When i go to "tlaravel.loc/"i get the core folder with all directories:
If i go to http://tlaravel.loc/public/
i get 500 error and: Whoops, looks like something went wrong.
After modify rights (maked writable) for next directories:
- public
- bootstrap/cache
- storage
i resolved the problem with 500 eror, but on the page is still the error:
Whoops, looks like something went wrong.
Now you've need to run these commands:-
For generate env key-
php artisan key:generate
And after that
composer update
It'll resolve yours issue.
The Upper answer is totally right, I'll explain it better what do you have to do in order to fix this problem
In your laravel project that you've installed, you have all of these folders and files in the root directory, as you can see... there's an .env.example file in the root folder
WINDOWS... maybe other OS DOES NOT understand/recognize what the heck is that for, but they need an enviroment file in the root folder in order to get the key that allows us to open the local server.
so what we have to do is to rename that file .env.example to just .env.
after that you have to try again putting in the shell/terminal:
php artisan key:generate
and then....
composer update
after that you run your server again and it will work!!!!
I have to publish a database in my laravel 4 app from another package. So I ran this command:
php artisan ab:install
It says
[InvalidArgumentException] There are no
commands defined in the "ab" namespace.
I tried running composer dump-autoload and also tried php artisan optimize.
Composer still throws the InvalidArgumentException.
EDIT
I had missed adding the service provider and registering the alias in the app.php file. Doing so fixed this issue.
I had missed adding the service provider and registering the alias in the app.php file. Doing so fixed this issue.
I had to add 'Jenssegers\AB\TesterServiceProvider', and 'AB => 'Jenssegers\AB\Facades\AB',
to the app/config/app.php
This fixed the issue.
Try to update composer with json file. Add the following code in json
"jenssegers/ab": "1.*"
Then save . Open command prompt. run composer update
Anyone familiar with this error i'm getting?
Please help thanks.
If you are using Laravel 5.3 do the following:
From the upgrade guides: The AuthorizesResources Trait
The AuthorizesResources trait has been merged with the AuthorizesRequests trait. You should remove the AuthorizesResources trait from your app/Http/Controllers/Controller.php file.
Seems like the problem is with your version of laravel/framework.. Running composer update should pull in the latest version (which is 5.2.39). If that doesn't work for you, then I'm not sure what else you can do. Perhaps try composer self-update before you do it.
If you run composer info laravel/framework the 4th line should show you the latest version from packagist, which is: 5.2.39.
Edit: You could try and clear your package cache: composer clearcache
Does Laravel connect to database? I had this error and it was caused by a wrong database configuration in .env file.
Try these settings in .env file:
1. Open .env file in your project's folder. Don't touch the .env.example file found in the same location as it's an example of .env default configuration. If something goes wrong with your .env file, you can copy and paste the configuration from the .env.example file to .env.
2. Change the following 4 lines to your own configuration:
DB_HOST=localhost
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=
DB_DATABASE It's the name of your database. Should be 'forge' by default or check your phpMyAdmin to determine which database you need to use. You can create a new database if you're an administrator of phpMyAdmin ('root' user).
DB_USERNAME This is your username when you log in to phpMyAdmin. Should be 'forge' by default.
DB_PASSWORD Your phpMyAdmin should not be protected with password by default. The password is set later manually. In case you'll set the password, add it to DB_PASSWORD line after you do so.
3. Save the modified .env file and restart the Apache server.
Try to access your webpage again. This worked for me. I hope it's gonna work for you, too.
P.S. If it doesn't work, check if the .env configuration is right for you. Or use php artisan config:clear to clear cache.
When trying to run php artisan migrate:make create_users_table I get the following output in Windows CMD:
{"error":{"type":"ErrorException","message":"require(C:\...\\localhost
\\sites\\makeitsnappy\\app\/filters.php): failed to open stream: No such file or
directory","file":"C:\\...\localhost\\sites\\makeitsnappy\\app\\start
\\global.php","line":83}}
I'm running Windows 8. Laravel 4 and installed Composer, also ran composer update in the project folder. Same error happens.
Edit: Loading the application webpage, I get:
require(C:\.../localhost\sites\makeitsnappy\app/filters.php): failed to open stream: No such file or directory
Also, there is no filter.php file.
How can I fix this problem?
Since Laravel4 the routes and filters are in two different files: routes.php and filters.php not like in Laravel3 where both lay in the same file.
Check if there is a filter.php file in you app/ folder.
The error occurs because the autoloader tries to load this file on application's startup to get the filters for the called route or global filters.
Running composer update won't help here because you only get the framework and it's dependencies via composer and it doesn't update your app/ folder.
did you do composer install? It downloads some important files. I think you missed this command!
composer install