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

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

Related

Unable to change working directory using shell_exec() in php

Iam working on my own php MVC. And now, I wanted to create a cli tool for starting a live server which can be used for development purposes. I'm using laravel-zero for building my cli. All the commands are working fine except the command that is supposed to start a server. To start my server, first I need to change my current working directory to public and then start a php server using 'php -S localhost:9000'
I have tried the below code, but it doesn't work:
shell_exec("cd public");
shell_exec("php -S localhost:9000");
I have also tried this, but this too doesn't work:
shell_exec("cd public ; php -S localhost:9000");
Finally after lots of google searches, I tried this, but the same result:
chdir("public");
shell_exec("php -S localhost:9000");
All It shows is just 'The system cannot find the path specified.'
If your current directory when running shell_exec() is your installation root directory, you can just add the path after php
shell_exec("php -S localhost:9000 -t public/");
But since you are using laravel, why dont you just run php artisan serve

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

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

Can't run Lumen Laravel

I have really silly question. I am new at Lumen. I find out that in 5.2 and 5.3 there isn't a command php artisan serve. How can I run it using xampp?
You may use php built in server in your project root in cli php -S localhost:8000 -t public

How to run laravel 5 on port 80 of localhost?

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

Categories