I've searched a lot about this but none of the solutions I encountered helped.
First time using Wampserver with Apache and PHP and my localhost displays:
403 Forbidden.
Forbidden
You don't have permission to access / on this server.
Apache/2.4.33 (Win64) PHP/5.6.35 Server at localhost Port 80
Also when I run httpd via cmd it shows:
C:\apache\bin>httpd
(OS 10048)Only one usage of each socket address (protocol/network
address/port) is normally permitted. : AH00072: make_sock: could not bind
to address [::]:80
(OS 10048)Only one usage of each socket address (protocol/network
address/port) is normally permitted. : AH00072: make_sock: could not bind
to address 0.0.0.0:80
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs
I uninstalled Skype because I saw it might have problems with port 80.
I've tried to Allow access all granted in httpd docs but didn't work.
Any ideas?
You need to go into Apache and change all port from 80 to 8080.
Related
guys. Good day.
I have an issue with Yii server on local.
I had to launch the Yii server on local and I typed command like below
> php yii serve --port=8081
Server started on http://localhost:8081/
Document root is "G:\yii\basic/web"
Quit the server with CTRL-C or COMMAND-C.
[Sun Jun 26 10:57:24 2022] PHP 7.4.5 Development Server (http://localhost:8081) started
This made port 8081 listening on my PC.
I checked that with
> netstat -n -a -o
...
TCP [::1]:8081 [::]:0 LISTENING 13844
...
command.
It showed that port 8081 was listening.
But then when I tried to access it on Chrome browser with URL
localhost:8081
it gave me the issue below.
This site can't be reached
localhost refused to connect
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
Disabling firewall did the same either.
What wrong? :( Any advice would be appreciated.
I have downloaded PhpStorm and set all the required configuration. When I try to run the project on port 80, I get this error.
Failed to listen on localhost:80 (reason: Permission denied)
And when I try to use any other ports like 8080 ,I get this error.
Failed to listen on localhost:8080 (reason: Address already in use)
I have tried several different random ports. But I get this already in use error all the time.
I have xampp installed. And when I try to run the url in browser with port , it works fine. The problem is that it isn't working on PhpStorm.
I am stuck.
The errors description are very clear:
The error:
Failed to listen on localhost:80 (reason: Permission denied)
You really don't have permission to use this port; so you need to change your user or use sudo to run your application.
and the error:
Failed to listen on localhost:8080 (reason: Address already in use)
The address that you are trying to use localhost:8080 is already in use by other processes/software.
Normally, if you change the port will solve the problem: (eg. 9090).
But, if you want to know which program is using the port 80 in Unix (Mac OSX, Linux), you can use the lsof command:
To do this:
In the terminal, you need to use:
sudo lsof -i :80
That will result something like this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 82 root 4u IPv6 0x763617bed21ecc33 0t0 TCP *:http (LISTEN)
httpd 226 _www 4u IPv6 0x763617bed21ecc33 0t0 TCP *:http (LISTEN)
On this result, we can see that the /usr/sbin/httpd is listening on port 80 on my machine, which is the Apache server.
To know the details of the process that is listening on port 80 you can use the ps command:
ps u PID_of_target_process
that will return a result similar to this:
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
root 82 0.0 0.0 2463324 4248 ?? Ss 9:48AM 0:00.93 /usr/sbin/httpd -D FOREGROUND
To kill the process by the PID you can use the kill command, like the following:
sudo kill -KILL PID_of_target_process
After you kill the process the port will be available again.
The PHPStorm / Intellij built-in web server listens on port 63342 by default.
https://confluence.jetbrains.com/display/PhpStorm/Using+the+Built-in+Webserver+in+PhpStorm
You can set the port in the Run/Debug Configurations under PHP Built-in Web Server:
Stop your Apache server from XAMPP.
Run your PHPStorm with ROOT privileges.
If running PHPStorm is showing your the same error saying Failed to listen on localhost:8080 (reason: Address already in use). The ports 80 is used by any other application. Try checking your used ports with a free tools out there. Stop the process using port 80 and try running the phpstorm.
Xampp for Mac
if you find you cannot get apache to run and you have
no apache web server already running!
......in terminal type.....
sudo apachectl stop
......then run......
sudo /Applications/XAMPP/xamppfiles/bin/apachectl start
.....if you have a port not specified you need to go into
applications/xampp/xamppfiles/etc/httpd.conf and on line 52 or 53
you have a ip or localhost you can set.
adding a port number
add :port number example 192.168.64.2:80 or localhost:80
save and run sudo /Applications/XAMPP/xamppfiles/bin/apachectl start }}}}}}}}}}}}}
I installed PHPMyAdmin via apt-get on my Ubuntu and I set the directory in apache2.conf, but when starting the server, nothing happens when http://127.0.0.1/phpmyadmin access and the following message appears I my console:
juninho-desktop:~$ /etc/init.d/apache2 restart
* Restarting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
[fail]
* The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
This is my /etc/apache2/apache2.conf file:
http://pastebin.com/yafW00S6
you could type:
netstat -lnptu
in your terminal. Then look for a programm that is blocking the Port 80.
This programm needs to be closed or must use another port :)
Permission problems, try to restart apache2 using root priviliges:
sudo /etc/init.d/apache2 restart
First thing, I could see out there has already solved questions around the problem.
PHP web socket unable to bind socket
Issue in setting the socket server
socket_bind(): unable to bind address [99] (Ubuntu on Amazon EC2)
and many other resources, all of them said that problem is in-used port or external IP,
etc.
But I could not get over it.
My server is running on CentOS 6.3 and using CPanel (it is the HP server https://www.hpcloud.com/).
The web socket demo source code what I get is on https://code.google.com/p/phpwebsocket/
My setting is
$master = WebSocket("127.0.0.1",4444); // even I tried with localhost, they worked same
Here is the step what I tried and the corresponding errors:
1/. I tried following commands to ensure a port which I was using is available to use
$ lsof|grep 4444
$ netstat -a -p -n
But I always got the error although this port 4444 is free
Warning: socket_bind(): unable to bind
address [98]: Address already in use in
/home/myapp/public_html/websocket/server.php on line 60
2/. The strange thing is when I checked the port 835 which was using by
crond 1621 root DEL REG 252,1 39835 /lib64/libpam.so.0.82.2.#prelink#.B1eyGx
atd 1633 root DEL REG 252,1 39835 /lib64/libpam.so.0.82.2.#prelink#.B1eyGx
The funny thing happened:
Then I ran the server.php on my terminal command shell
php /home/myapp/public_html/websocket/server.php
the error has gone, instead of it is
Server Started : 2013-08-16 03:19:54
Master socket : Resource id #4
Listening on : 127.0.0.1 port 835
I thought that it started working, but actually it did not, because when I open server.php by the browser with URL
http://mysite/server.php
The error is "permission denined"
Warning: socket_bind() [function.socket-bind]: unable to bind address
[13]: Permission denied in
/home/myapp/public_html/websocket/server.php on line 60
socket_bind() failed
Edited: About permission, I could open the client.html in same level directory with server.php without problem.
The folder code permission is 755 and user is not root.
All of my commands was implemented under root privilege
Any help is greatly appreciated :(
I would assume that the problem is that you are attempting to load the Websocket server in your webbrowser. Most likely, there are security settings for the apache user that does not allow your server to listen on uncommon ports.
CentOS usually ships with SELinux enabled by default. Part of CentOS Linux's security policies for Apache are that by default, Apache will only allow services access to recognized ports associated with HTTP (ie, port 80, 8080 etc).
With SELinux enabled, you could allow Apache to listen on tcp port 4444 by adding a rule to allow that inside SELinux using the 'semanage' command:
~$ semanage port -a -t http_port_t -p tcp 4444
Alright, when I go to install Apache 24 by command prompt with this code going into it's bin.
httpd.exe -k install
then I run httpd.exe
I get this error.
AH00558: httpd.exe: Could not reliably determine the server's fully qualified do
main name, using fe80::d939:4e4:4915:276. Set the 'ServerName' directive globall
y to suppress this message
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions. : AH00072: make_sock: could not bind to address [::]:80
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions. : AH00072: make_sock: could not bind to address 0.0.0.0:80
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs
and then I pinged my port that is using 80. I get the PID of 4 which is my system with a description of NT Kernel & System.
Anyway I can fix this?
you could try to run command prompt as administrator
The port 80 is already used and when you try to modify it in the file conf/httpd.conf nothing changes. My mistake was that I assumed that the install folder is the one I have chosen to use via installation. If you go to services and find the Apache service and check the path to executable, you will see that it is not pointing to the folder that you thought you have installed it on. However, if you change the line "Listen 80" to "Listen 8080' in the httpd.conf file from the folder taken from the service path, it will most likely allow you to start the service.