Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run laravel project in localhost

I have installed laravel by composer create-project laravel/laravel –-prefer-dist

after this run php artisan serve command to laravel project directory and get this result.

Laravel development server started: http://127.0.0.1:8000

But when i go to http://127.0.0.1:8000 in browser laravel project not running and give error

This site can’t be reached 127.0.0.1 refused to connect.

but http://localhost/laravel/public/ it is working. Can anyone tell me that what is proper way to run this laravel project.

like image 701
Magecode Avatar asked Feb 10 '18 10:02

Magecode


People also ask

Can I run Laravel without xampp?

If you install PHP Desktop Application, it allows you to run PHP script like a Desktop Application. And so, you don't need any kind of server software like XAMPP. Laravel, as a well established framework has a few different options available for running a development environment and running your application.

How do I run multiple Laravel projects on localhost?

First, run your first Laravel project blog as follows: Open your command prompt and go to your drive where your Laravel project exists. Now type http://localhost:8000 in the browser and your blog project will run. Now go to your browser and type http://localhost:8080 in your browser your another project will also run.


1 Answers

Try to run in different port

php artisan serve --port=9000

and then try http://127.0.0.1:9000 will work.

As might be on port 8000 something already running on your system will not make it work.

And you can also run your laravel project without artisan serve command

If anyone wants to make the application public, the more easy and fastest way is:

  1. Rename the "server.php" file in root directory, in "index.php"
  2. Move your .htaccess from public folder to root directory
  3. Make your directory accessible to Apache2 (set all file permissions to 777).
like image 169
Naincy Avatar answered Oct 17 '22 07:10

Naincy