How to run multiple Laravel projects at same time?

◇◆丶佛笑我妖孽 提交于 2019-12-09 05:47:42

问题


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?


回答1:


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


Reference:

  • Can two applications listen to the same port?



回答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



回答3:


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.

Thank you for reading this article. Hope your problem get solved.

You can also get your solution from this link




回答4:


This is how I run multiple laravel projects in Linux environment

php artisan serve opens port 8000 by default for the first laravel project you have opened.

:/var/www/html/projectOne# php artisan serve Laravel development server started: <http://127.0.0.1:8000>

To run a second or more laravel projects on the same machine you have to specify the port for each new instance.

Run the following command as an example in the folder of the second laravel

(using port 8080)

:/var/www/html/projectTwo# php artisan serve Laravel development server started: <http://127.0.0.1:8080>

For the third project, you can run the following command

(using port 8888)

:/var/www/html/projectTwo# php artisan serve Laravel development server started: <http://127.0.0.1:8888>

Note that I randomly chose the ports.



来源:https://stackoverflow.com/questions/43817947/how-to-run-multiple-laravel-projects-at-same-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!