localhost host not working on XAMPP - xampp

I am facing same problem to the thread. I've gone through all the suggestions provided in the solution. I've searched all possible solution but nothing gonna workout.
"http://stackoverflow.com/questions/817745/localhost-not-working-on-xampp-both-service-apache-mysql-are-fine"
I've ensured :
1. Xampp is successfully started (in log) but it is not receiving any request(checked access.log).
also ensured that it is running on port 80 in config file.
confirmed status of application using netstat
C:\Documents and Settings\user>netstat -aon | grep 80
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 3524
Checked host file in /windows/system32/drivers/etc/hosts and has only one entry
127.0.0.1 localhost
skype teamviewer or other application are closed and configured not to use port 80.
ensured that windows firewall allows http process to use port 80.
pinged localhost, 127.0.0.1 and my ip (192.168.1.2). localhost resolves to 127.0.0.1
tried different urls http:// localhost http:// localhost:80 http:// 127.0.0.1 http:// laptop-name but nothing works. browser just waits for response (spaces after http to allow links in this post)
ensured that there is no loop in index.php(it is untouched) and also has index.html. also tried diffent paths
nothing gonnna work out. I am irritated and I dont want to format my machine. please help....

when this happens to me it is usually Skype taking over the default localhost address

Check on command prompt
netstat -a -b
And close any other application like skype etc using 80 port.

Try stopping IIS. It worked for me.
Select Start, then type IIS in the search box
select Internet Information Services Manager
In the manager on the right under "Manage server"select "stop"

I was having an issue with Last.fm that is very similar to yours, and I found that it was a software conflict.
The Last FM scrobbler application would not finish installing on my new build because it couldn't login or authenticate my username. I tried the regular scrobbler application and then tried the beta desktop program on Windows 7 64 bit. I suspected Skype or TeamViewer, but even after stopping or exiting those programs, neither versions of the installation would log in to the services.
The beta desktop application actually authenticated on 127.0.0.1 (random port) through my internet browser, but my browser would time out trying to send data over the port.
I checked and edited my HOSTS file in Windows, but that didn't fix the issue either.
Pinging 127.0.0.1 worked, but pinging any variation of the port would time out.
Finally, I decided to uninstall the Windows 7 Firewall Control program made by Sphinx Software. Mind you, I had set the firewall to be disabled at start up (clean start-up - all startup programs disabled through MSConfig).
I made sure that the firewall program was not running at all in my services. However, after uninstalling the software, even without restarting my computer, 127.0.0.1 opened up on all ports and my Last.fm scrobbler finally connected and finished installation.
So, it may be a hidden setting that can only be undone by uninstalling programs (even programs that aren't running).

For me localhost was not the correct address.
Type into cmd "hostname" and use that as the url.
CMD -> hostname
If that doesn't work try just the ip address of the server (or computer)

I stored my website folder in xamp/htdocs (windows machine). Then I started apache on the XAMP control panel. My pages rendered successfully when I called http://localhost/mysite/index.html.
I hope this is helpful.

Related

Localhost refused to connect on WSL2 when accessed via https://localhost:8000/ but works when using internal WSL IP adress

What I'm Trying to Achieve
To access localhost from my local machine during the development of a Symfony web app.
My Environment
WSL2 running on Windows 10
Linux, Apache2, MySQL, PHP-7.4 stack (with Xdebug3 intalled)
Debian 10
Symfony 5.4 (although not sure on if relevant to this problem)
Steps I've Taken
Set up WSL2 according to this Microsoft WSL2 tutorial
Set up LAMP stack according to this Digital Ocean tutorial
Set up Symfony according to this Symfony tutorial
Run the following bash script on startup to start my services and set the host to the virtual WSL IP in my xdebug.ini file
#!/bin/sh
REMOTEIP=`cat /etc/resolv.conf | grep nameserver | sed 's/nameserver\s//'`
sed -i -E "s/client_host=[0-9\.]+/client_host=$REMOTEIP/g" /etc/php/7.4/mods-available/xdebug.ini
service php7.4-fpm start
service apache2 start
service mysql start
Run my Symfony project on the development server using symfony serve -d (Symfony then tells me "The Web server is using PHP FPM 7.4.23 https://127.0.0.1:8000")
Go to https://localhost:8000/ in Chrome where the app is running
What I Expect to Happen
My Symfony web app to be running on https://localhost:8000/ when I visit the URL in my Chrome browser
What Actually Happens
I get "This site can't be reached localhost refused to connect." in the Chrome browser
What I've Tried
This used to happen less frequently and I would give my laptop a restart, repeat the process above, and I could connect via https://localhost:8000/. However, it refuses to connect more regularly now (like 8/10 times I start up for the day)
Connecting to https://127.0.0.1:8000 yields the same result.
Connecting to the site using the internal WSL IP address, found using hostname -I and replacing localhost with this IP (still on port 8000). This is an adequate workaround to use my app, however I am unable to interact with my database via MySQL Workbench without having to set up a new connection, therefore a fix where I can use localhost would be very helpful!
(Based off comments) Only ran symfony serve -d without starting apache and PHP services separately - still sometimes allows connections to localhost but sometimes doesn't work.
Conclusion
The behaviour is odd as it works sometimes but other times it doesn't when the exact same steps are carried out. I am unsure where else to look for answers and I can't seem to find anything online with this same problem. Please let me know if any config files, etc would be helpful. Thank you so much for your help! :)
When it's working normally, as you are clearly aware, the "localhost forwarding" feature of WSL2 means that you can access services running inside WSL2 using the "localhost" address of the Windows host.
Sometimes, however, that feature breaks down. This is known to happen when you either:
Hibernate
Have the Windows "Fast Startup" feature enabled (and it is the default). Fast Startup is a pseudo-hibernation which triggers the same problem.
Typically the best solution is to disable Hibernation and Fast Startup. However, if you do need these features, you can reset the WSL localhost feature by:
Exiting any WSL instances
Issuing wsl --shutdown
Restarting your instance
It's my experience that localhost forwarding will work after that. However, if it doesn't, thanks to #lwohlhart in the comments for mentioning that another thing to try is disabling IPv6 on WSL2, since (I believe) there's a possibility that the application is listening on IPv6 while the Windows->WSL2 connection localhost connection is being attempted on IPv6.
You can disable IPv6 on WSL2 per this Github comment by creating or editing .wslconfig in your Windows user profile directory with the following:
[wsl2]
kernelCommandLine=ipv6.disable=1
A wsl --shutdown and restart will be necessary to complete the changes.
If you find that this works, it may be possible to solve the issue by making sure to either use the IPv4 (127.0.0.1) or IPv6 (::1) address specifically in place of localhost on the Windows side, or by configuring the service to listen on both addresses.
Try to run command netstat -nltp. It shows active addresses and ports. Your nginx process should be run at 0.0.0.0:8000. 0.0.0.0 means the nginx process is available from anywhere.
If your nginx process is ran by any specific ip address, you should access it by that ip address, e.g http://192.168.4.2:8000.

Can't access 127.0.0.1

I can't figure out when this started to happen, but the result is - 127.0.0.1 is not working on any port from anywhere (for example, browser says Unable to connect). Here are the results of my research:
localhost, COMPUTER_NAME and actual IP address all work fine
there is nothing special in my hosts file
ping to 127.0.0.1 and tracert do work fine
all the programs that have 127.0.0.1 hardcoded are not working (this point makes me disappointed the most, because I can't do anything in this case )
What else can I do to identify the source of problem and fix it?
UPDATE: as soon as Redis does work on 127.0.0.1 and both IIS and AzureStorageEmulator don't work I assume this is HTTP only issue.
Just one command did the work
netsh http add iplisten 127.0.0.1
If it's a DNS problem, you could try:
ipconfig /flushdns
ipconfig /registerdns
If this doesn't fix it, you could try editing the hosts file located here:
C:\Windows\System32\drivers\etc\hosts
And ensure that this line (and no other line referencing localhost) is in there:
127.0.0.1 localhost
In windows first check under services if world wide web publishing services is running. If not start it.
If you cannot find it switch on IIS features of windows: In 7,8,10
it is under control panel , "turn windows features on or off".
Internet Information Services
World Wide web services and
Internet information Services Hostable Core are required.
Not sure if there is another way to get it going on windows, but this worked for me for all browsers.
You might need to add localhost or http:/127.0.0.1 to the trusted websites also under IE settings.
I had a similar issue. Check your listen port.
A mistake I made ealier was
app.listen(() => console.log(APP_NAME} is listening on port ${PORT}`))
Make sure you include the port as shown below
app.listen(PORT, () =>{
console.log(`${APP_NAME} is listening on port ${PORT}`)
})
This answer may seem overly obvious, but in most cases it is sufficient to simply remove the "localhost" entry in the "Host Name" field:
In the end for us, it was IE11 that was blocking for 127.0.0.1 - after adding it to the exceptions list, it loaded the page.

Filezilla FTP Server Fails to Retrieve Directory Listing

I'm running Filezilla Server 0.9.45 beta to manage my server remotely.
After setting it up, I tested connecting to it using the IP 127.0.0.1, and it worked successfully. However, to connect to the server remotely, I port forwarded to port 21, and tried to connect using my computer's IP.
Status: Connecting to [My IP]:21...
Status: Connection established, waiting for welcome message...
Response: 220 Powered By FileZilla Server version 0.9.45 beta
Command: USER hussain khalil
Response: 331 Password required for user
Command: PASS *********
Response: 230 Logged on
Status: Connected
Status: Retrieving directory listing...
Command: CWD /
Response: 250 CWD successful. "/" is current directory.
Command: PWD
Response: 257 "/" is current directory.
Command: TYPE I
Response: 200 Type set to I
Command: PORT 192,168,0,13,205,63
Response: 200 Port command successful
Command: MLSD
Response: 150 Opening data channel for directory listing of "/"
Response: 425 Can't open data connection for transfer of "/"
Error: Failed to retrieve directory listing
This continues to work locally, but not when connecting remotely... How can I fix this?
I just changed the encryption from "Use explicit FTP over TLS if available" to "Only use plain FTP" (insecure) at site manager and it works!
File > Site Manager > Select your site > Transfer Settings > Active
Works for me.
Most of the answers here involves configuring, actually just by adding sftp:// on your host (see below image) you can instantly fixed that kind of problem, works for me.
And also take note that if you follow Vaggelis guide you are lowering your security, sftp is better than using plain ftp.
I just changed the encryption from "Use explicit FTP over TLS if available" to "Only use plain FTP" (insecure) at site manager and it works!
When you send the port command to your server, you are asking the server to connect to you (on the remote network). If the remote network also has a NAT router, and you have not port-forwarded the port you are sending with your PORT command, the server will not be able reach you.
The most common solution would be to send the PASV command to the server instead of the PORT command. The PASV command will ask the server to create a listening socket and accept a connection from the remote machine to establish the data connection.
For the PASV command to work, you will also need to port-forward a range of ports for the passive data connections. The passive connection ports (which need to be forwarded) should be listed in the FileZilla documentation.
Ok this helped a lot, I couldn't find a fix.
Simply, I already port forwarded the FTP port to my server. (The default is 14147, I'll use this as example)
Go to Edit > General settings, Listening port should be the one your using, in this case 14147.
Then go to Passive Mode Settings, I checked "Use Custom Port", and entered in the Range 50000 - 50100.
Then on your router, port forward 50000 - 50100 to the server IP locally.
IPv4 specific settings I left at default, reconnected my client, and bam now the file listing appears.
Ensure your servers firewall has an inbound rule set to accept 14147, and 50000-50100.
Basically what Evan stated. I can't attest to the security of opening these ports, but this is what finally got my Filezilla client and server to communicate and view files. Hope this helps someone.
My experience is that the new version of Filezilla has this problem, but not the old versions. I was using Filezilla and everything was OK. After I upgraded to version 3.10, I faced this problem and I couldn't solve it. I uninstalled version 3.10 and reinstalled version 3.8 and the problem was gone! Now I am using version 3.8 and everything is OK. I prefer to face no problems even if I have to use old versions. ;)
Try installing the old version and do not upgrade, however odd that may sound.
I solved this by going into Site Manager -> selected the connection that Failed to retrieve directory listing -> Switched to tab "Transfer Settings" and set "Transfer Mode" to "Active" instead of "Default". Also check if you are connected via VPN or anything similar, this can also interfere.
Run Windows Defender Firewall with Advanced Security
Start > Run : wf.msc
I had the same problem-what worked for me -in Windows OS-is adding FileZilla as a firewall exception-under allow a program through firewall features
I've had the same problem, This was due to the firewall. I use windows server,
Can you allow the connection permission for program, intead of port 21,22 permission.
Windows Firewall with Advanced Security->
Inbound Rules->
Add Rule->
Program->
"Select Filezilla path with Browse button"->
Allow the Connection
I had Filezilla 3.6, and had the same issue as OP. I have upgraded to 3.10.3 thinking it would fix it. Nope, still the same.
Then I did a bit digging around the options, and what worked for me is:
Edit -> Settings -> FTP -> Passive Mode and switched from "Fall back to active mode" to "Use the server's external IP address instead"
I experienced the same problem with FZ-client, while my notebook connected via WLAN and DSL/Router. In the Site Manager connection settings I was applied Host:ftp.domain-name, Encryption:Only use plain FTP (insecure) and User:username#domain-name. Then the FTP-client succesfully connected to my website server.
More FTP connection information could be found in the CPanel of the webserver. Hope this helps.
It worked for me:
General -> Encryption -> Only use plain FTP
Transfer settings -> Transfer Mode -> Active
Consider that it is very insecure, and must be used only for testing.
After about 2 hours experience;
Open > Windows Defender Firewall with Advanced Security
Select > Inbound Rules
Click > New Rule...
Choose > Custom
Choose > This program path:
Click > Browse
Find > filezilla-server.exe (possibly C:\Program Files\FileZilla Server)
Click > Open
Click > Next
Click > Next
Click > Next (Allow the connection is already selected)
Click > Next (if you do not need change)
Fill > Name
Click > Finish
I also had the problem after upgrading to 3.10. I had versoin 3.6.02 hanging around and installed that. Problem solved.
I had that problem with my server hosted in the cloud. I only need the server a couple of times a year and so when I boot up my server the IP address changes. The new IP address then has to be updated on FTP Server passive mode settings!
The latest version of Filezilla works just fine!
If you're using VestaCP, you might want to allow ports 12000-12100 TCP on your Linux Firewall.
You can do this in VestaCP settings.
Check if the ip address on the router is the same with the one on the ftp server. If not make sure it is the same. This should works perfectly.
In my case, restarting my router which I used to connect to the internet worked. I think too much of connections were going from the same IP Address and when I restarted my router, possibly a new IP was assigned and now everything works fine, and passive mode gives good speed in directory listing.
My issue was also the firewall. I'm using a Linux server with WHM/cPanel. Adding my IP to the quick allow solved my issue. I hadn't updated Filezilla and I don't think there were any changes to the server that should have caused it. However, I did move and my IP changed so maybe that was the problem. Good luck to everyone else with this insanely annoying issue.
The issue of mine was the same but the solution was a little different.
I used the AWS EC2 server to host the WHM service. And found that "the passive ports are enabled, but not these Ports are not found in my EC2 Security Group".
[root#94367392 ~]cPs# egrep -i passiveport /etc/pure-ftpd.conf
Output:
PassivePortRange 49152 65534
Now I moved ahead and opened the ports from 49152 to 65534 in the Security group of EC2 and the Filezilla problem related to "Failed to retrieve directory listing" was solved and it worked like a charm.
This cPanel doc is helpful.
I've seen solutions that involve granting FileZilla full access via windows firewall. This is an alternative to that, if you know the IP of the connecting system and it's static, simply grant it full access to all ports via windows firewall.
Windows Firewall, Inbound Rules > Create a Rule > All Local Ports > Scope > This IP Address (the IP of the connecting system).
To me this is much safer than granting full access to FileZilla to all incoming ip addresses.
Once you've completed your transfer, you can then disable the rule.
I tried all the solution, i used CyberDuck and it works..
Now in FileZilla, create a new Account
1. Host is the FTP Address - e.g. ftp.somewhere.com
2. Protocol is "SFTP-SSH File Transfer Protocol"
3. User ID is your Bluehost User Id
4. Password is your Bluehost Password
5. Click "Connect" to establish a connection with Directory Listing!
This resolve the issue with 3.10 for me. And I'm glad to have the Secure Access for all of my future file transfers. It should prevent security issues in the future.

WAMP not working on Windows 7 Enterprise

I am using WAMP on Windows 7 Enterprise. It was working fine initially, even though the icon remained red in the tray. My PC remains on 24x7 but yesterday I restarted it due to a pending windows update. And now, WAMP no longer works i.e. I cannot access anything under localhost. The browser (chrome) returns a webpage unavailable error.
I do not have Skype installed. I did try and test, and it said that Port 80 is used by some other application. As I do not have admin rights, I reconfigured the httpd.conf file for Apache to port 81, but even that did not help.
I also ran a netstat -ao using CMD, but I could not find anything running on Port 80.
Any ideas as to what can be done to solve this? Thanks.
I had the same issue in my windows 7 home basic.
Maybe you could solve by this:
1)Your port 80 is mostly blocked by Microsoft iis server. so if iis is using port 80 than apache wont be able to use the port.
2) So, change the listening port of apache. apache has a file name httpd.conf.Open the file in a text editor and there will be port 80 already written, change the port to 8080 (mostly people use 8080).
3)So now your Apache runs on different port.
4) Restart apache services or restart your wamp server.
5)now Open your local host by, localhost:8080
6)you will see your localhost page.
Hope it solved your problem.

apache in xampp won't turn on - after it worked before

I recently installed Xampp on my windows machine. It worked when I just did it, see here. However, now the apache won't turn on. I realize that I did not close it correctly (did not use xampp_stop), so maybe that could be the cause.
The error I am getting is:
make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
unable to open logs
How can I get it to work?
Just ran into this very well do documented blog with respect to Apache not working.. I think its really good to reference if you have apache startup issues.
apache friends
here are the steps that i note from the link:
Check that xampp folder is not in a folder containing spaces or brackets ie (Program Files (x86)
Make sure that you have run \xampp\setup_xampp.bat (probably as administrator)
in CMD run -netstat -a (or look in Xampp control beta 3 - and press the netstat button... ) , make sure that nothing is running on port 80 ( on win 7 a lot of the time its actually skype that uses port 80) ( quit skype and try again, if so, in skype --> options ->> advanced --> make sure the "use port 80 as alternative checkbox is unchecked"
If "system" is using port 80, then its windows that is using it ( i have read that that is some IIS service) - if you enable xampp as a service and re-boot then xampp grabs port 80 before system...
If you dont want to run as a service then open xampp\apache\conf\http.conf and change the port that apache will run on (search for string "Listen 80" and "ServerName localhost:80" and change 80 to something else eg: "180")
Make sure you are running Xampp control.exe as administrator
Stop your firewall temporarily to see if its being stopped (then try startup apache again) if so, create an exception in windows firewall
Check that your anti-virus is not stopping it.
If you are running windows 7 64 bit ultimate (sp1) (like i am) - then you may still have a problem (like i am)
last try is to delete xampp folder, and download a previous version of xampp, then try again.
If you have any other steps that you think may also cause a problem, please comment.
I ended up solving it.
Go to the Xampp control panel. Check the "Service" check box.
Clicked on "SCM" button. (Or "Service" button, there on the "SCM" button).
Then I clicked on the "Apache" in the list of services. Turned it on.
Now it is labelled as "Running" in the control panel, and "localhost" works.
I ran into this issue a couple months ago. You have to set Apache as an automatic windows service by checking the Svc checkbox in the XAMPP Control Panel. Once you have set it as a service, you will need to restart windows before you can start apache. Once you have restarted windows, you should be able to stop and start Apache through the XAMPP Control Panel.
From a blog post about it:
The reason you have to do this is because Windows 7 has a service called http.sys which starts automatically and uses port 80. Running Apache as an automatic service causes apache to start before the http.sys service. This allows apache to get port 80 before http.sys starts.
One: If it is running as a service, check your services in windows and make sure it is stopped.
Two: If it is not a service, it will just be a process; go into the task manager and find httpd / apache and terminate the process.
Three: Make sure you are running xampp_start / xampp_control as administrator, on some systems this is important.
I would recommend always using xampp_control as it gives a quick window into whether Apache is supposedly running or not even if some unusual events recently occurred.
Try
netstat -aon | more
If this doesn't work, to see if anything else is listening on that port, and terminate that process.
You may also wish to edit Apache's httpd.conf (probably in xamppdir/apache/conf) to listen to another port and see if it will launch.
Steps:
change the httpd.cong file in those lines:
Listen 8080
ServerName localhost:8080 ( port as example, 8080)
Now, create a xampp.ini file where the xampp-control.exe located and put the code into it:
[PORTS]
apache = 8080
Now restart the xampp.
Hope, it will work to change the apache port. But if you have installed oracle 10g client or any software in which perl is installed then do some more steps like bellow:
4.change the lines from:
`# Perl settings`
`Include "conf/extra/httpd-perl.conf"`
to
`# Perl settings`
`#Include "conf/extra/httpd-perl.conf"`
Now restart the xampp and it works properly in 8080 port.
I found the problem in TeamViewer application - it uses port 80 by default. Under advanced setting I made changes so the application will not use port 80 or 443 for incoming connections. Then switched of xammp and ran again. It works!
I had a similar problem, and after a bit of research, found out that the culprit in my case was the "World Wide Web Publishing Service" (W3SVC in the iissvcs Group).
Apache in XAMPP ran without a problem after stopping this service in my case.
My XAMPP Apache all of the sudden wouldn't start, and, while I wasn't getting that error message specifically, it was because I installed a Skype upgrade, and Skype took over port 80 when my PC started which blocked Apache. I tweaked a Skype advanced setting to fix this.
If your issue hasnt been solved, scan this page for the "windows auto fix" link. It worked for me: Ran the tool, restarted PC, all ports open, instantly on.
http://support.microsoft.com/kb/811259/en
GL
This might help others that's why I am posting my particular solution. I recently swapped Zend Server CE for XAMPP (2.5). The VHOSTS file had to be set-up with an Include directive to an error_log. I was having issues with SVN so I wiped the project I am working on to get a fresh install. However, I happened to start XAMPP prior to doing an svn checkout. That's when I noticed apache doing the Busy...Apache started [Port 80] business. Someone's comment on this thread reminded me of the Include directive. I climbed through the directories and added a blank error_log and blammo! Apache started up nicely.
This might help someone else too :)
In my case I solved it by opening xampp\apache\conf\http.conf.
I changed Listen 80 to Listen 2337
Above that line I had to add Listen 127.0.0.1:80
Then I opened xampp\apache\conf\httpd-ssl.conf
I changed Listen 80 to Listen 7332
Then I could connect to localhost again.

Resources