Before Laravel, Have you ever tried to serve your PHP project on the localhost web address?
// index.php
<?php
echo "It's amazing.";
?>
php -S localhost:8080 index.php
Laravel
When you run the Artisan command php artisan serve
on your terminal, you will find the Laravel application on the web browser at the endpoint http://127.0.0.1:8000
or http://localhost:8000
. Now, the questions arise what happens when the multiple Laravel application is serving on the same endpoint?
Surely, there will be only one application served on the browser among those. But here are some alternative ways that you really loved it.
-
Changing the port
Hm! Yes, you are free to change the default serving port
8000
to8050
(Let's say) or whatever you like.php artisan serve --port=8050
-
Changing the host address
Just like the port, you are also allowed to change the served IP address on Laravel. Let's the change default host from
127.0.0.1
to127.0.0.2
.php artisan serve --host=127.0.0.2
Let's hit the
127.0.0.2:8000
URL on the browser. BOOM! It really works. -
Using XAMPP Control Panel.
HAVE YOU EVER TRIED IT BEFORE? XAMPP is a free PHP development environment containing Apache, MariaDB, PHP, and Perl distribution. It is available for all three platforms: Windows, Linux, and macOS.
Once you have XAMPP Control Panel on your machine, change the default apache to your Laravel project public (/public folder) directory. And then start the Apache module. BOOM! At
http://localhost
endpoint, you will find your Laravel application.
Any Question / Leave a comment ?
--- Thank you for your attention! ---