apache24/PHP8 windows 10 localhost Unable to connect - php

Apache24/conf/httpd.conf:
Port Listen 8080
I have set everything and tried port :80 and :8080, both doesn't work, what am I missing?

It worked properly now.
steps on how it worked
Legend: IPv4Address: 192.168.1.5 it should be different on your machine
cmd>ipconfig
copy IPv4Address
open Apache24/config/httpd.conf
line 59: Listen IPv4Address:8000
line 60: Listen 8000
line 218: ServerName IPv4Address:8000
save file
cmd> cd C:\Apache24\bin
cmd>./httpd for me httpd without ./httpd didn't work for some reason
refresh http://localhost:8000 or http://IPV4Address:8000 and it should work!
I think because I had run cmd>npm run dev ports 80 and 8080 were taken (although the server is offline now), luckily port 8000 is free.
Thanks #JamesYoung

I think you should check your computer process.
Below are the process check command
# for window
tasklist | findstr "httpd"
# for linux
ps -ef|grep httpd

Related

WAMP in Windows 8 (64 bit) doesn't work

I've installed wampserver. Yet it is always as a red tray icon.
Icon tooltip msg: local server - None of 2 services running.
Port 80 is not occupied; checked with Apache ► Service ► Test port 80:
Warning: chmod(): Permission denied in C:\wamp\scripts\config.inc.php on line 68
Impossible to modify the file C:\WINDOWS\system32\drivers\etc\hosts to be writab
le
The file C:\WINDOWS\system32\drivers\etc\hosts is not writable
***** Test which uses port 80 *****
===== Tested by command netstat filtered on port 80 =====
Test for TCP
Port 80 is not found associated with TCP protocol
Test for TCPv6
Port 80 is not found associated with TCP protocol
===== Tested by attempting to open a socket on port 80 =====
Your port 80 is not actually used.
Apache ► Service administration ► Install Service issues in a cmd window:
pressing Enter shuts the window down, nothing happens. Waiting gives no profit either.
What's wrong?
Update
Had attempts to change port number for Apache (both to 81 and to 8080) in httpd.conf:
Listen 0.0.0.0:8080
Listen [::0]:8080
ServerName localhost:8080
Checked whether IIS is runnig => No!
.
Doesn't help.
I had the same problem, and the solution was too simple:
"Run it as Administrator."
Without changing port or other additional configuration ...
You can do it by right clicking on the program icon and in the menu that appears, select the option "Run as administrator".
It is also possible to automate this process, by right clicking on the program icon and selecting "Properties".
Once the properties window is open, we go to the "Compatibility" tab. In the "Configuration" area we mark the option "Run this program as administrator".
Then we will click on "Apply" and then on "OK".
Ready! From now on, every time we run the program it will do so in administrator mode.
(Today, May 8, 2019, I see that #riggsfolly has responded in a comment much earlier than me. My recognition.)
I had same problem, tried change port and so on, but finally I installed older version (2.5 I think) and it works without any change of setting.
I think that IIS in install your windows
Change your port on httpd.conf
for example 81
Listen 0.0.0.0:80
Listen [::0]:80
ServerName localhost:80
to
Listen 0.0.0.0:81
Listen [::0]:81
ServerName localhost:81
and restart apache service
Open the httpd.exe in administration manually. The file is in wamp64\bin\apache\apache2.4.23\bin\. Then it works.
You can try this
Uninstall the wamp server
Click on the downloaded wamp file , and select Run as Administrator
Read and follow the Information Window that will pop up after one or two steps
Complete the installation
Still ? Check out http://forum.wampserver.com/read.php?2,134915
It can happen because of one of the three reasons:-
1) Missing VC++ installation: Install All versions of VC++ redistribution packages VC9, VC10, VC11, VC13, VC14 and VC15.. If you have a 64-bit Windows, you must install both 32 and 64bit versions of each VisualC++ package, even if you do not use Wampserver 64 bit.
2) You forgot to provide Admin Privileges to WAMP Server : Launch and Install with the "Run as administrator" option, very important.
3) WAMP, IIS and Skype fighting over same port :
Close Skype or force not to use port 80: http://forum.wampserver.com/read.php?2,134915
Disable IIS: http://forum.wampserver.com/read.php?2,134915

Can't start latest WAMP and XAMPP?

I can't start WAMP 2.5 and XAMPP 7 but I can start WAMP 2.2 so its not port 80 issue ( I have listed all programs with netstat in cmd ). I have run httpd.exe in cmd but it didn't give me useful information on cmd ( nothing ).
Thanks for the answer
Change your port and try once
Edit your httpd.conf in XAMPP
Change this to
#Listen 12.34.56.78:80
Listen 80
this
#Listen 12.34.56.78:80
Listen 85
Then access your localhost useing
localhost:85/
If its same open cmd and type netstat -nab and check whats showing with port 80

OSX: Failed to listen on localhost:80 (reason: Permission denied)

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

"Apache started [Port 80] Busy..."-This type of error shows

My xampp is not working. I am getting the following error
Apache started [Port 80] Busy...` error is shown in xampp-control.
While Im typing in browsers url localhost/phpmyadmin, it shows Not Found HTTP Error 404. The requested resource is not found.
Maybe port 80 is used by another program.
On Windows you can see if there is any other program using port 80 with the command
netstat -a -b
You can also try using a different port than port 80 and see if that works. See:
https://stackoverflow.com/a/15029626/2802916
Use this command to find a port which is using:
netstat -an | find "80"
If the result like this, some programm is using 80 port
TCP 127.0.0.1:80 0.0.0.0:0 LISTENING
Use netstat -o -n -a | findstr 0.0:80 to find the process which use port 80 and stop it.
Otherwise, you can change the port in httpd.conf to something else, after change, save it and restart apache.
Start->Accessories right click on "Command prompt", in menu click "Run as Administrator" (on Windows XP you can just run it as usual), run netstat -anb then look through output for your program.
BTW, Skype by default tries to use ports 80 and 443 for incoming connections.
You can also run netstat -anb >C:/ports.txt It will print info to .txt file related to all ports and you can search easily.

Could not run socket server

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

Categories