T echnojs
Already have an account?
login Login

Or,

Don't have an account?
group_add Register

Showing suggestions...

close
cookie
Cookies Consent

This site uses cookies to offer you a better browsing experience.

Laravel: Let's enhance your skills

Let's change the default serve port, host address & endpoint of PHP Laravel application. Browser web address from 127.0.0.1:8000 to 127.0.0.2:8050.

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:8000Now, 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 to 8050 (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 to 127.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.

by
question_answer Comments
bar_chart Views
people_alt Contributors
category Category workspaces Group
public Visibility
monetization_on Monetisation
checklist Authorization
save Created
today Updated

Any Question / Leave a comment ?
--- Thank you for your attention! ---

Related Posts