Home > Enterprise >  If I run it on laravel localhost, it shows me only file, how to fix it
If I run it on laravel localhost, it shows me only file, how to fix it

Time:11-08

If I run laravel on localhost, it shows me only file, how to fix this enter image description here

CodePudding user response:

The main index.php file is in Laravel's public/ directory. If you visit http://localhost/Employee/public, you'll likely see your Laravel site.

If you point your webserver's DocumentRoot at that directory, you'll be able to visit the app at http://localhost/. If you want to run multiple apps locally, you'll want to start playing with virtualhosts.

Alternatively, consider using Laravel's Valet, Sail, or Homestead options for local development; each will handle this sort of thing for you. Sail is Laravel's current recommendation.

CodePudding user response:

You can use a web server such as Apache or Nginx to serve your laravel applications. If you have PHP 5.4 and would like to use PHP's built in development server you may use the serve artisan command:

 cd /project_directory
 php artisan serve

By Default it will run application on port 8000

If you want to change to other port specify port number like

 php artisan serve --port=8080

It will run your application on the PHP development server on localhost:8080

Docs: https://laravel.com/docs/4.2/quick#local-development-environment

  • Related