buli.diriba
buli.diriba

Reputation: 101

Artisan Error: Failed to listen on localhost:8000 (reason: An attempt was made to access a socket in a way forbidden by its access permissions. )

I'm having problem starting my laravel installation. Whenever I type in the terminal php artisan serve, it throws me an error like below:

c:\wamp\www\blog>php artisan serve Laravel development server started on http://localhost:8000/

[Sat Nov 05 21:18:39 2016] Failed to listen on localhost:8000 (reason: An attempt was made to access a socket in a way forbidden by its access permissions.)

Upvotes: 10

Views: 29153

Answers (6)

Mehrdad Masoumi
Mehrdad Masoumi

Reputation: 410

You should stop and start the winnat service. Open a cmd administrator and run the below commands.

net stop winnat

The Windows NAT Driver service was stopped successfully.

net start winnat

The Windows NAT Driver service was started successfully.

If you are using Node.js, Next.js, or other languages, you can resolve this problem without restarting the system.

Upvotes: 1

Pratik
Pratik

Reputation: 810

I faced the same problem today. I just restarted the my machine, after that tried with the same port and it works!

Upvotes: 4

Masood Anwar
Masood Anwar

Reputation: 73

You need command prompt to run as administrator, that solves the problem most of the time.

Upvotes: 1

Sahan Pasindu Nirmal
Sahan Pasindu Nirmal

Reputation: 441

Change artisan serve port using this command

php artisan serve --port=#### 

instead #### you can enter your own port number.

This will work sure.!

Upvotes: 1

nu1_ww
nu1_ww

Reputation: 536

1) First firewall restore to default

2) change artisan serve port using this command php artisan serve --port=3232

Trust me its works :)

Upvotes: 20

Sachith Muhandiram
Sachith Muhandiram

Reputation: 2972

First make sure your installed Laravel properly in your local machine.
When you execute php artisan serve , you better to run it with administrative priviledges.
In linux, I use
sudo php artisan localhost:8888 -t public


Make sure other requirements such as php version are upto date.

PHP >= 5.5.9
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension

For more information refer this document.

Upvotes: 0

Related Questions