-1

I am beginner on laravel. Now, I want to run laravel project on localhost. Now, what I have done? I have create index.blade.php file inside resource/view/index.blade.php and modify web.php file inside routes/web.php

routes/web.php

<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('index', function () {
    return view('index');
});

resources/view/index.blade.php

<!doctype html>
<html>
    <head>
        <title>Demo</title>
    </head>
    <body>
        <h1>Laravel start</h1>  
    </body>
</html>

I have change server.php to index.php and move .htaccess file from public to root directory and restart apache server. but it show me 500 Internal Server Error. I have run localhost/laravel but its not working. So, How can I fix this problem? Please help me.

Error occuring

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@dummy-host2.example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.4.29 (Win32) OpenSSL/1.0.2l PHP/5.6.32 Server at localhost Port 80

Thank You

Rudra
  • 156
  • 1
  • 4
  • 13
  • provide your error with details, example : the code line etc. – Tharaka Dilshan Oct 02 '18 at 06:59
  • Please look at once @TharakaDilshan – Rudra Oct 02 '18 at 07:01
  • 2
    why you want to change server.php file to index.php file ? – Emtiaz Zahid Oct 02 '18 at 07:02
  • 1
    You could follow the [Installation instructions](https://laravel.com/docs/5.7/installation#installing-laravel) and not rename core files. `public` should be your server's DocumentRoot. – brombeer Oct 02 '18 at 07:02
  • I have follow instruction https://stackoverflow.com/questions/28788285/how-to-run-laravel-without-artisan – Rudra Oct 02 '18 at 07:06
  • in local environment there no need to change those files. when you use an framework please try to understand its structure and purpose of it. – Emtiaz Zahid Oct 02 '18 at 07:09
  • ok when I start php artisan it start laravel on `127.0.0.1:8000` but How can I run other file using this. it basically run `welcome.blade.php` file but if I have `index.blade.php` so how can I run this file on `127.0.0.1:8000` @EmtiazZahid – Rudra Oct 02 '18 at 07:12
  • 2
    You can by calling your routes in your browser. So `http://127.0.0.1:8000/index` should show your defined route. https://laravel.com/docs/5.7/routing#basic-routing – brombeer Oct 02 '18 at 07:14

4 Answers4

0
after fresh install , just run command "php artisan serve" , 
because server.php is modified to run server on any directory without putting project in xampp\htdocs , 
If You want to run through localhost replace index.php and .htaccess from public to root directory of project
hope this helps :)
0

Don't change any file on laravel project if you need just create new folder or file then run it as you know.

if you want to run only laravel project you can run it but if you want to work with database you should use xampp or wampp localhost server.

Hope you may success.

Naveed Ramzan
  • 3,565
  • 3
  • 25
  • 30
0

It could be due to various issues:

  • Artisan serve is not working
  • Trigger file permission issue
  • Folder permission issue
  • Apache server status

You need test one by one like create a separate folder and then inside a new file with simple echo "I am here"; and see if it works.

Next step you need to check command or alternates

Then you need to check permissions of folder and files

If still issue, then maybe need to check into server settings.

Naveed Ramzan
  • 3,565
  • 3
  • 25
  • 30
0

If you guys have cloned project from a remote repository or local project

  1. Make sure you have .env.example file
  2. If exist copy content and write on new file called .env
  3. If there is no .env.example file create .env file and paste file from fresh laravel project .env file

This way I solved my issue. I hope it will help you too!!!

Bushra Mustofa
  • 1,075
  • 7
  • 12