0

I'm developing a project with Laravel that will be run (and used) on a local machine. Is it advisable to simply run it with "php artisan serve" or should I install a server for it? Does this command have any impact on the app's performance?

And if I can rely on that command for launching the application, can I change the port on which it runs or will it always be 8000? Can I customize it so that the app will only be accessible from localhost?

Edit: The intended version for the project is 5.3

Ayrton
  • 2,218
  • 1
  • 14
  • 25
  • You can run localhost on another port https://stackoverflow.com/questions/17990820/set-port-for-php-artisan-php-serve. If you use mac, you can install valet then park catalog domain and use name of catalog at domain example your-project.loc. For other system you can use homstead. Check documentation https://laravel.com/docs/5.8. – Piotr Kazuś Mar 01 '19 at 14:15
  • 3
    You can use php artisan serve --port=8888 to run in different port. – Abhilash.k.p Mar 01 '19 at 14:16
  • 2
    `serve` is only accesible locally by default – apokryfos Mar 01 '19 at 14:18
  • You should use Laravel/Homestead instead. – Zoli Mar 01 '19 at 15:11

1 Answers1

3

Does this command have any impact on the app's performance?

Yes. php artisan serve uses PHP's built-in dev webserver, which states:

The web server runs only one single-threaded process, so PHP applications will stall if a request is blocked.

If your app makes multiple simultaneous requests (like an image gallery, or multiple CSS + JS files on your page), or multiple users are accessing it concurrently, or if any of your requests are particularly slow to process (like making external cURL calls), it will be slow as the requests will be handled one-by-one sequentially.

Running it on Laravel Homestead or Valet will be more performant.

ceejayoz
  • 176,543
  • 40
  • 303
  • 368