laravel 5.4 php artisan serve Invalid request (Unexpected EOF) - php

I am using windows 10 and wamp server and I am fresh installing laravel and all i get is this error message and is it necessary to do php artisan serve everytime i open laravel ? as long as i close cmd prompt localhost:8000 refused to connect .
Php artisan serve error

I think you are running a Laravel project blog by command php artisan serve and you are browsing your application by localhost:8000 or 127.0.0.1:8000
Your screenshot saying that when you are trying to visit a url which is not defined in your routes/web.php then, you are getting invalid request (Unexpected EOF) error in your cmd.
And of course! in this case when you close cmd then your Laravel app will not run.
So now, if you don't want to run your Laravel app by the following command each time, then you can use Laragon in windows environment.

Either you have to run php aritsan serve or set up a virtual host in your OS. Here is how to set up a virtual host in Ubuntu 16.04: How To Set Up Apache Virtual Hosts on Ubuntu 16.04

This is case, you can keep your cmd open. And open another cmd, redirect to file path where you are working and it should work fine.

Related

Laravel shows error in "localhost:http://127.0.0.1:8000/"

I used Laravel in Visual Studio code, and when I opened localhost:http://127.0.0.1:8000/ bypassing command php artisan serve, I got an error.
So I used another command php -S localhost:8888 -t public, I used this 8888 localhost. But I can't understand why localhost:http://127.0.0.1:8000 is not working.
This is an image of a browser:
you need to go at your laravel project path and run cmd after that run this command.
Another solution is here
php - Unknown: Failed opening required on line 0. laravel 5.6

I'm facing problem in laravel that is "This site can’t be reached 127.0.0.1 refused to connect."

I face this error only when "php artisan serve" command is not running. If this command is running then there is no such a error, but as i closed command prompt this error occurs. i have also changed port but no vain.
Kindly help me.I would like to mention here that I'm using Window 10 OS.
Thanks in advance.
If you don't have a HTTP server (like WAMP or similar installed), you'll need to keep the Command Prompt / Terminal window running at all times. Closing the window or stopping the php artisan server command will terminate the server that's running the website.
If you want a persistent server, you should look into server software like WAMP or XAMPP.
Note that this is expected behavior for the php artisan serve command.
because with this kind of server (like: LARAGON), running 'php artisan serve' is necessary, so if you close the terminal, 'php artisan serve' will automaticaly stop running, then the server will stop too, then you can't reach anymore your localhost.
If you want a persistent server, you should look into server software like WAMP or XAMPP.
Note that this is expected behavior for the
php artisan serve command

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 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

Installing Laravel on Windows

Using Windows 7.
I am following Laracasts - Laravel Setup for Newbs https://laracasts.com/lessons/laravel-installation-for-newbs but when it comes to the 4:25 mark where i enter php artisan serve I get the following showing up.
C:\Users\Pierce\Desktop\laravel-demo>php artisan serve
Laravel development server started on http://localhost:8000
[Wed Mar 19 00:29:46 2014] Failed to listen on localhost:8000 <reason: An attempt was made to access a socket in a way forbidden by its access permissions.>
I have XAMPP installed straight from the box and followed the instructions in the video. What happens that I get stopped here?
you can use another port, something like this
php artisan serve --port="8888"
this port work fine for me.
php artisan serve is a command to fire up PHP's own web server. If you are using XAMPP already, I would suggest using it's built-in Apache web server and then run Laravel through that. There are plenty of documents online on how to setup XAMPP.
As for your error, it's Windows UAC that is blocking it. Disable UAC or set or exception for your program.
Buy a mac
Else
Delete XAMPP
Install Laragon (http://laragon.org/)
All problems solved!!!
I suggest you avoid using htdocs folder of xampp. Because in this method, I could not route to other pages. So you should do this, php artisan serve --port="8888" or other port (as mininoz said).

Categories