Failed to listen on 127.0.0.1:80 (reason: Permission denied) PhpStorm Xdebug
Solution 1
Try executing command as follows to check whether port 80 is already used by other program.
ss -nltp | grep -iw 80
If the above command is not found in your ubuntu (older ubuntu version doesn't have the ss command) then try following cmd.
netstat -nltp | grep -iw "80"
If port 80 is used by any application , it will be listed there . If you found so then you need to first stop that application or else you need to change the port of that application to something else other than port 80. Atfer that try running your application so it can easily bind to port 80.
Solution 2
Sorry to necrobump the thread but it shows up in search engines.
Ports under 1024 are privileged ports, meaning you need elevated permissions to bind them. This, obviously, includes port 80 as specified in the original question and PHPStorm which is started by a non-privileged user.
More information can be found here https://www.cyberciti.biz/faq/linux-unix-open-ports/
Ammar Mehmood
Updated on September 18, 2022Comments
-
Ammar Mehmood over 1 year
I have been using phpstorm to develop PHP applications in windows. I shifted to Ubuntu because a friend suggested. I recently configured Xdebug with PHPStorm, but I am unable to try it because it is given me this error:
Failed to listen on 127.0.0.1:80 (reason: Permission denied)
I am using PHPStorm 2016.2. It is running without debugging, but when I try to run in Web Server for debugging it gives this error
ANy help would be highly appreciated.
-
Ammar Mehmood over 7 yearsOnly apache is running
-
Ammar Mehmood over 7 yearsweired it's working on 8080
-
SAGAR Nair over 7 years@AmmarMehmood So your application is configured to run on 8080 , so y .
-
Ammar Mehmood over 7 yearsto summarize my xampp is running on 80 and web server is running on 8080 which I am using for debugging . shouldn't the ports be same ?
-
OnethingSimple about 6 years@SAGARBHOOSHAN I appreciate the commands (they are useful), however I seem to have identical issue as OP where :8080 works fine and :80 exits with (reason: Permission denied). There is no process listening on 80, I even tried using
sudo ss -nltp
andsudo netstat -nltp
. When Isudo php -S 127.0.0.1:80
the server goes up and I can see that it is listening on port 80 using either ss or netstat. I don't want to run a sudo server though so I took it down immediately. -
SAGAR Nair about 6 years@OnethingSimple : you have got an error Permission denied on Port 80 because Ports < 100 are considered privileged ports. So you need to bypass it or in other words give permission for the application to use one of the privileged ports.
-
OnethingSimple almost 6 years@SAGARBHOOSHAN Thanks, I was unaware of that fact. It shines new light on the problem.