I am working on laravel project but I am stuck due to this message"An Error Was Encountered
The configuration file database.php does not exist."
I solved this after realizing that the project I was working on was merged with codeigniter project and that the file database.php was missing in codeigniter.I created it and that was it.
Related
I am using Laravel 5.7. My application is working fine last night. but suddenly this error appears. I did not change any file. Now I am searching for a solution but I did not find any. I am new on laravel I am not familiar with core files of Laravel.
please check the error in the attached image.
here is .env session portion
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
And this is env file code
I dont have any file session.php file in config
Going of the conversation in the comments, the issue is that you don't have a session.php inside your config directory. The reason this is an issue is because Laravel will use that config file to get the name of the session driver and, like all config values, if it isn't present it will just return null.
Adding the default session config file to that directory should solve your issue.
Today I tried uploading my first website,but i'm getting an error.On the local server it works fine but when I uploaded it to the live server,i'm getting an error that is saying "Whoops, looks like something went wrong".To be more specific it's showing twice on the same page.Check the image bellow.
Steps followed while uploading project to live server:
Zipped the file
Created a new folder at the root directory.
Unzipped the file in the new folder.
Moved all the files from public folder to /public_html/
Edited the locations on the index.php file.
Note: Other than index.php I haven't altered any other file.
I followed a lesson on youtube and with these steps, his project worked but mine is throwing an error.
I have also noticed that after unzipping the folder in the cpanel the .env file is missing.Could this be the issue?
Make the .env file is there .
Then don't forget to generate the application key
php artisan key:generate
There are some times that the .env file isn't being read by the server. You may try to edit the .env file and supply the necessary credentials according to your server such as the following:
APP_URL= *
APP_KEY= *
DB_CONNECTION=mysql
DB_HOST= *
DB_PORT=3306
DB_DATABASE= *
DB_USERNAME= *
DB_PASSWORD= *
The lines with the asterisks are the ones you typically need to fill up. The APP_KEY can be set by using the php artisan key:generate command in your local workspace, then copy the value to your live server.
If the .env can't be read and it still shows an error, try to edit the config/app.php file and change 'key' => env('APP_KEY'), into 'key' => yourgeneratedkey,. Try to also change the values in your config/database.php file into the same one as your .env file
Follow the installation guide https://laravel.com/docs/5.6
Check the server requirements(check if all the required extensions are installed).
Check if all the files are there.
Check Configurations
check config.php file
check directory permissions.
generate application key (php artisan key:generate)
Check if .env exists or not
thanks to all of you who replied.I found the solution.It turns out the cause for the error was a simple spelling mistake in my .env file.
This is caused by missing ".env" file, copy the content of ".env.example" file and create a new ".env" file in the same directory as your "example.env" file.
then run: php artisan key:generate
In my Laravel (5.4) project I want to use sqlite. But when trying to access it I get an "Database does not exist" error.
In my .env file I use
DB_CONNECTION=sqlite
DB_DATABASE=database/easyresults.sqlite
I used touch database/easyresults.sqlite to create the db and successfully ran the migrations using php artisan migrate. But when accessing it using a XMLHTTPRequest, I get the error above.
After changing the path in the .env file to
DB_DATABASE=../database/easyresults.sqlite
I can acces it again, however any command line call doesn't work then.
What am I missing? Does it not work using the .env file? Do I have to use database_path('easyresults.sqlite') and put it directly into config/database.php?
Thanks a lot for your support.
If you want to have the database filename in your .env you can do database_path(env('DB_DATABASE', 'dbfilename')); in your config/database.php
then in your .env you would have
DB_DATABASE=easyresults.sqlite
I have uploaded my Laravel 4.2 project (using Filezilla) which is stored in folder name main-Laravel into the htdocs folder on bytehost.when I tried accessing it like this http://bcms.byethost8.com/main-laravel/public/, I an error saying Fatal error: require(): Failed opening required '/home/vol12_4/byethost8.com/b8_16140412/htdocs/main-laravel/bootstrap/../../main-laravel/vendor/autoload.php' (include_path='.:/usr/share/pear/') in /home/vol12_4/byethost8.com/b8_16140412/htdocs/main-laravel/bootstrap/autoload.php on line 17. I did not have this problem when working on my local machine, so what can I do to resolve this problem and thanks in advance.
You will need to do additional setup to get Laravel working on a shared hosting.
Laravel needs composer to get the autoloading right and few other requirements to be run (such as higher PHP version, several PHP extensions & so on).
Here you can find more info:
http://laravel-tricks.com/tricks/setup-laravel-4-in-shared-hosting-with-securing-laravel-base-file
I just got a script from a friend and was written with the laravel framework. After uploading the script to my file manager, i am having this error
Warning: require(C:\xampp\htdocs\bin\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\bin\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\bin\bootstrap/../vendor/autoload.php' (include_path='\xampp\php\PEAR') in C:\xampp\htdocs\bin\bootstrap\autoload.php on line 17
From the error, i saw that the vendor folder was missing in my files and my friend also didnt have it.
I saw many articles talking about installing composer but i'm not having the laravel framework and the project is already on a web server.
Things i have tried.
I have copied other "vendor folder" from other laravel script i have, doesnt work.
I also tried installing composer on my pc and copied the vendor folder generated. still doesnt work
Please i will be very happy if anybody can help with this.
Thanks in advance.
IF you try upload your project to web hosting. follow this step.
compress whole project on your xampp/wampp/etc with zip extension
upload to your web hosting.
extract the file
create "Laravel" Directory
Move All Your File (your laravel Project) to "Laravel" Directory, EXCEPT "Public" directory.
open your "Public" directory, and move to public_html or parent directory or one step before your "Public" directory ("../")
edit your index.php (previously in "Public" Directory)
Edit this code
require DIR.'/../vendor/autoload.php';
$app = require_once DIR.'/../bootstrap/app.php';
to
require __DIR__.'/laravel/vendor/autoload.php';
$app = require_once __DIR__.'/laravel/bootstrap/app.php';
and don't forget update your database connection on your .env file :)
I have found a way of generating the folder and it works.
I install composer for windows on my system , then navigate to the htdocs folder in xamp where i kept the file. then run this command
--composer installer--
After some mins, it downloaded some files and generate the vendor file itself.
i then zip the folder and upload it to my web host
Thanks every one