ktaro
ktaro

Reputation: 433

Laravel-Php artisan serve url (127.0.0.1:8000) vs localhost/laravelproject/public

I want to access my laravel project.I run php artisan serve and access the 127.0.0.1:8000 in browser.

But i learned that I can also check my project using the localhost/laravelproject/public url whithout running php artisan serve.

Question: What is the point of using php artisan serve?

Upvotes: 2

Views: 4261

Answers (3)

Exterminator
Exterminator

Reputation: 1246

The `Serve command is just a shortcut for the PHP Builtin Webserver, something PHP has out of the box, so the point of using it is to start testing your application as fast as you could, you just need to install PHP, Composer and your application is up (if you don't need anything else, of course). But if you already have Nginx installed, there is no point at all, just use it.

It's not wise to use the Builtin Webserver in production.

Upvotes: 1

Abel
Abel

Reputation: 53

I found some information you may find interesting:

https://www.quora.com/How-can-I-use-php-artisan-serve

But in simple words, php artisan serve is an easy way to create a php server and that is what laravel needs to run.

You could do the same with "php -S 8080 (which would start a php web server (single threaded) in the current directory on port 8080)"

Also if you have already a php server running with apache or nginx it would not be necessary any of the commands.

Hope you find this helpful.

Upvotes: 1

Hanumant
Hanumant

Reputation: 102

No point in two different methods like you mentioned run laravel by "php artisan serve" and by "project url" followed by localhost. But advantage of "php artisan serve" is you can run you laravel project without putting in htdocs/www directory i.e servers root directory. You can put laravel project anywhere where you want and run through the artisan command.

Upvotes: 5

Related Questions