How to run laravel 5 on port 80 of localhost? - php

For previous versions of Laravel, you can simply download laravel with composer in the root folder of your apache server and type in http://localhost/public/ to see the "You've arrived" homepage.
I know I can use php artisan serve to view the Laravel5 default home page, but it is run on localhost:8000 and I heard that php artisan serve command should not be used in production due to the limit of connection and the bad performance. Is there a way I can see the default home page without using the php artisan serve command?
And it is really frustrating that Laravel is not including such simple thing in their installation documentation....

To run the service on another port you need to pass the port parameter with port numberusing this code on the cmd:
php artisan serve --port=80
To run on port 80, you might need administrator permission.

You may have to use sudo command for admin rights.
sudo php artisan serve --port=80

Related

Laravel 7.28 not work without php artisan serve command in localhost

Laravel 7.28 not work without php artisan serve command in localhost
I install new Laravel in localhost (/var/www/html/NewLaravel)
When I run http://localhost/NewLaravel/public/ not workling
but when I run with php artisan serve its working on http://127.0.0.1:8000/
Apache2 is working proper and allow access of override for .htaccess
is that new Laravel will only work with php artisan serve ?? or something is missing from my side ?
Step-1:
run apache and sql from xampp server
step-2:
in browser type localhost/NewLaravel and press enter
Step-3:
in list please select public folder it will run

Serve multiple laravel apps on localhost with php artisan serve

I'd like to be able to serve more than one laravel app at the same time on different tabs/ports, this is so I can showcase various designs, sadly when I run php artisan serve I can get only one app running at a time on port 8000.
Even after updating to laravel 5.8, form the docs:
Artisan Serve Improvements
In previous releases of Laravel, Artisan's serve command would serve your application on port 8000. If another serve command process was already listening on this port, an attempt to serve a second application via serve would fail. Beginning in Laravel 5.8, serve will now scan for available ports up to port 8009, allowing you to serve multiple applications at once.
Is there anything I'm missing?
Use php artisan serve --port='YOUR-PORT' command.
or
you can create a variable SERVER_PORT in your .env file
Example:
SERVER_PORT=80
you can add --port #### when you run php artisan serve like this:
php artisan serve --port 8001, this will run your project on port 8001
You can use Laravel Valet for this, you essentially have local domains for each site, I use it daily on MacOS if you're on windows this should help:
https://github.com/cretueusebiu/valet-windows
Run php artisan serve --port port_number this will run your project on your defined port.

Why can't I run my laravel app with PHP artisan serve?

I'm working on a laravel app. I made the simple installation of a new laravel app, and in the previous days it was running great.
But now I'm not able to access my project in browser after running php artisan serve. The browser just says page not found and the buffering of that page is like infinite.
I tried to run the server in a different port with:
php artisan serve --port=9000
and then accessed it in http://127.0.0.1:9000/
It run well once, but then it stopped again.
You could try out the following:
php -S localhost:8000 -t public To run withe inbuilt PHP server
Make a fresh installation of a laravel project and copy your files into it.
It didn't work for me but I used composer:
php artisan serve --port=9000
Then it hanged. I press CTRL+C and I got it working without any errors
Try this, I got solved by these;
1) Change the default url to like this - localhost/<your-project-name>/public/ instead of default one 127.0.0.1:8000
or
2) use this php -S localhost:8000 -t public or php -S 127.0.0.1:8000 -t public

Laravel does not work on mac

Laravel does not work on after successful installation on mac. When I run the command: php artisan serve it is opened at http://127.0.0.1:8000/ as well as url of virtual host. (i.e. laravel.dev). After quitting the command php artisan serve if I make any change and refresh the browser, it displays blank page again.
It works with me when I change port 8000 to another one for example I use port 8080.
Try the following :
In your command line prompt try : php artisan serve --port=8080
Go to your browser with : localhost:8080

How to access a Laravel site from another machine on the same network?

I have a Laravel site on my computer which I can access by typing the php artisan serve command. However I cannot access the site from another machine on the same network.
Is there a way to access the site from another machine?
Yes there is! There are two ways to go about it.
Method 1: Passing a Host Parameter to Artisan
First figure out your computer IP address. If you are on Linux or Mac, type ifconfig at the terminal. If you are on Windows, type ipconfig at the command prompt.
Then, go to your Laravel root directory and just type:
php artisan serve --host=XX.XX.XX.XX
If you'd also like to pass the port parameter, just add --port=XX to the artisan serve command.
Method 2: Serving via a Webserver (like Apache)
Setup Laravel inside your Apache webserver directory through composer. Navigate to your laravel directory and set permissions of the storage folder to 777 by typing this command at the terminal: sudo chmod -R 777 storage/
Access your Laravel site by navigating to
http://IPADDR/laravelproject/public
And voila!

Categories