I'm learning how to build a blog using Laravel and following along on these youtube tutorials: https://www.youtube.com/watch?v=R8B4og-BeCk
I made a mistake in tutorial part 13 locally which I didn't know how to fix, but I had the project up on Github so I decided to use an older version which I knew had worked perfectly after finishing tutorial number 12. I then purposely deleted the entire broken project locally, and downloaded the zip from Github and simply copy pasted the entire older Github blog commit into the local folder (as suggested here by Sivan: How to get certain commit from GitHub project)
But when I went to test the site on my browser by running "php artisan serve" in the terminal as normal (I'm using Ubuntu as my os) it came back with the same error as here Laravel 5 Failed opening required bootstrap/../vendor/autoload.php . I followed the advice of Shubhamoy Chakrabarty and ran "composer update --no-scripts", and it then seemed to be working.
So I ran "php artisan serve" once again in the terminal and the response in the terminal appears positive as it comes back with the usual: Laravel development server started on http://localhost:8000/ [Sun Jul 10 13:55:19 2016] 127.0.0.1:58276 [200]: /favicon.ico
But when I go to test the site in the browser, it comes back with the error "Whoops, looks like something went wrong." and the error message "Failed to load resource: the server responded with a status of 500 (Internal Server Error)".
And this is the point I'm at now and wondering if you could help me with. Please feel free to tell me if I went about it wrong at any point and what I should do now as I'm still figuring out the best way to go about this.
Thanks very much in advance!
I am glad you are enjoying the Laravel Series.
There are a few things on here that might help you. First of all, make sure you have ran all of the migrations which might be causing problems if your Database is not in sync with the code. You can do this in the terminal by typing php artisan migrate
and running the command.
Also it sounds like your project is not running in development mode. In development mode, Laravel will publish more detailed errors about what is happening, instead of simply a 500 error. This will help us debug the problem.
Remember that on GitHub there are always a few files that do not get sent to the repo that you might need. One of these files is the .env
file that contains important information about your project to Laravel. In this file it will tell Laravel to run the project in development mode, which in turn will reveal the detailed error messages.
The default .env file should look like this:
APP_ENV=local
APP_DEBUG=true
APP_KEY=11mw9hJML4VDO3PGrtIFnUaE8hCrXads
DB_HOST=127.0.0.1
DB_DATABASE=blog
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=localhost
REDIS_PASSWORD=null
REDIS_PORT=6379
Of course your app key might be different. It is autogenerated when you build a new app or you can generate it yourself. You can use the one above if you don't have one. Also note that the APP_DEBUG
is set to true which will give you those better error messages.
Note also the DB settings. Make sure your database settings work. Check the DB_DATABASE
to the name of your database, the DB_USERNAME
and DB_PASSWORD
also should match the settings of your database.
Try this and see if this works. Also once the database settings are in your .env file then you will want to run php artisan migrate
as well.
Let me know if that helps.