19

To run one laravel project we only need to type "php artisan serve". and it will be available on port 8000.

But sometimes we need to run multiple projects at the same time. How can we do this?

Amin Adel
  • 970
  • 3
  • 17
  • 33

5 Answers5

47

tl;dr one cannot have more than one listener per TCP port at the same time. If you need more web server instances: try another port:

php artisan serve --port=8001

then go to http://localhost:8001


References:

Mike Doe
  • 16,349
  • 11
  • 65
  • 88
2

You can also run web server on multiple port in PHP application by the following command.

php -S localhost:8000 
php -S localhost:8080
Nazmul Hasan
  • 1,937
  • 13
  • 21
1

First run your first laravel project blog as follows: Open your command prompt and go to your drive where your laravel project exist. And type php artisan serve

C:\xampp\htdocs\blog>php artisan serve

Now type http://localhost:8000 in browser and your blog project will run.

Again open another command prompt and again go to your another laravel project bloganother

C:\xampp\htdocs\bloganother>php artisan serve --port=8080

Now go to your browser and type http://localhost:8080 in your browser your another project will also run.

miken32
  • 42,008
  • 16
  • 111
  • 154
0

1- First thing you need to mention port number in .env file. APP_URL=http://127.0.0.1:8001 2- Run php artisan serve --port=8001

-1

Run first laravel project (with url: http://localhost:8000)

php artisan serve

Run another laravel project (with port specific url: http://localhost:8001)

php artisan serve --port=8001

Run one more laravel project (with port specific url: http://localhost:8002)

php artisan serve --port=8002
Billu
  • 2,733
  • 26
  • 47