Localhost not working on XAMPP - both service apache & mysql are fine - windows-vista

My xampp installation 1.7.1 does not seem to work.
http://localhost returns not found error.
Xampp Control panel shows both mysql & apache service running fine.
I'am on windows vista. Frustrated since past 2 weeks to find a solution to this. Any pointers and support will be appreciated!
Thanks a ton folks.

I struggled for days figuring out why I was getting a blank screen while using xampp. The cultprit was skype. Always turn of skype when you want to use localhost.

In your "xampp" menu group, one of the items is "Port Checking". If I run it, I get:
***************************************************************
* XAMPP PortCheck v1.2 *
* *
* (c) 2005 Carsten Wiedmann <info#wiedmann-online.de> *
* *
* This script uses openport.exe: *
* (c) 2003 DiamondCS <http://www.diamondcs.com.au/openports/> *
***************************************************************
Please wait a moment...
RESULT
------
Service Port Status
==============================================================================
Apache (HTTP) 80 C:\bin\xampp\apache\bin\apache.exe
Apache (WebDAV) 81 free
Apache (HTTPS) 443 C:\bin\xampp\apache\bin\apache.exe
MySQL 3306 free
FileZilla (FTP) 21 free
FileZilla (Admin) 14147 free
Mercury (SMTP) 25 free
Mercury (POP3) 110 free
Mercury (IMAP) 143 free
Press <Return> to continue.
Can you run this, and what do you get?
You can also try the following (esp. if you get Apache (HTTP) Port 80 as in my results):
First see if apache is serving your port 80. I just did this with my setup using telnet.
telnet localhost 80
You should get a blank screen. You can type but there's no echo. If you don't get this, Apache isn't operating as your localhost web server, so we need to find out why.
If it is, choose a file you know exists in your web server root directory (using "index.html" as an example, enter (you may not see what you type):
GET /index.html
Apache should just display the file contents (in raw form). See if you get this far.

try your machines IP (eg 192.168.x.y)
try tcp/IP-Loopback: 127.0.0.1
try your computername (use ipconfig /all to retrieve your computername)
ping localhost and compare the ip

Have you upgraded to PHP 5.3 on Windows recently?
If so, change 'localhost' to '127.0.0.1'. See: http://bugs.php.net/45150
Here is some code which can be used to make an installation portable:
# Convert localhost to 127.0.0.1 on PHP 5.3.x on Windows (Vista); see http://bugs.php.net/45150
if ($hostname == 'localhost') {
if (substr (PHP_OS, 0, 3) == 'WIN') {
if (version_compare (PHP_VERSION, '5.3.0', '>=')) {
$hostname = '127.0.0.1';
}
}
}

Related

MongoDB no suitable servers found

I'm having trouble connecting to a replica set.
[MongoDB\Driver\Exception\ConnectionTimeoutException]
No suitable servers found (`serverSelectionTryOnce` set):
[Server closed connection. calling ismaster on 'a.mongodb.net:27017']
[Server closed connection. calling ismaster on 'b.mongodb.net:27017']
[Server closed connection. calling ismaster on 'c.mongodb.net:27017']
I however, can connect using MongoChef
Switching any localhost references to 127.0.0.1 helped me. There is a difference between localhost and 127.0.0.1
See: localhost vs. 127.0.0.1
MongoDB can be set to run on a UNIX socket or TCP/IP
If all else fails, what I've found that works most consistently across all situations is the following:
In your hosts file, make sure you have a name assigned to the IP address you want to use (other than 127.0.0.1).
192.168.0.101 coolname
or
192.168.0.101 coolname.somedomain.com
In mongodb.conf:
bind_ip = 192.168.0.101
Restart Mongo
NOTE1: When accessing mongo from the command line, you now have to specify the host.
mongo --host=coolname
NOTE2: You'll also have to change any references to either localhost or 127.0.0.1 to your new name.
$client = new MongoDB\Client("mongodb://coolname:27017");
I had the same error in a docker based setup:
container1: nginx listening on port 80
container2: php-fpm listening on port 9000
container3: mongodb listening on port 27017
nginx forwarding php to php-fpm
Trying to access mongodb from php gave this error.
In the mongodb Dockerfile, the culprit was:
CMD ["mongod", "--bind_ip", "127.0.0.1"]
Needed to change it to:
CMD ["mongod", "--bind_ip", "0.0.0.0"]
And the error went away. Hope this helps somebody.
The IP address of your home network may have changed, which would lead to MongoDB locking you out.
I solved this problem for myself by going to MongoDB Atlas and changing which IP address is allowed to connect to my data. Originally, I'd set it up to only allow connections from my home network. But my home network IP address changed, and I started getting the same error message as you.
To check if this is the same issue with you, go to MongoDB Atlas, go into your project, and click "Network Access" on the left hand side of the screen. That's where you're able to update your IP address. It shows you what IP address(es) it's allowing in. To find out what your current IP address is, go to whatismyipaddress.com and update MongoDB if it's different.
In my case, I am temporarily coding PHP from Windows7 against MongoDB on my VPS running Linux Debian 9. The PHP will be eventually running in the same Linux box to provide an API to the MongoDB data.
BTW, it does not appear this local composer install is doing me any good, it's pure ugliness. My PHP after the fix below works without the require line require_once 'C:\Users\<Windows User Name>\vendor\autoload.php'.
My fix is different than the accepted answer which to me did not make sense.
I did not have to touch any hosts file
So edit your /etc/mongod.conf with your target machine's IP and restart with sudo systemctl restart mongod that's it
I don't know what to blame
PHP and MongoDB sites for the terrible documentation skimpy and incomplete PHP examples, or...
MongoDB installation on Linux failing to mention this bindIP.
My startup experience with MongoDB is so far very negative given all the changes that have occurred nothing matches what I expected from the videos I watched. I can't seem to find any that reflect what I am going thru like
$DB_CONNECTION_STRING="mongodb://user:password#164.152.09.84:27017"
$m = new MongoDB\Driver\Manager( $DB_CONNECTION_STRING )
instead of
$m = new MongoClient()
Hope this helps someone
PS. Always say NO to semicolons, camelCAsE and anything case-sensitive... absurdity at its best.

Unable to start XAMPP Apache server on MacOS-Sierra

Whenever I'm trying to start my Apache server from XAMPP on my Macbook (MacOS-Sierra) . I'm getting following application log :
Starting Apache Web Server...
/Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh : httpd started
And status remains Stopped. I re-install XAMPP and restarted my laptop multiple times, but I'm still having same issue. Couldn't find anything help to resolve this issue.
I found the solution:
Make sure port 80 is not being used (Use Network Utility and scan for port 80. If you found any application using port 80, then kill it)
Open terminal and execute
sudo apachectl stop
(ignore, if you get any error)
On the same terminal window execute
sudo /Applications/XAMPP/xamppfiles/bin/apachectl start
Open XAMPP control panel, your apache server might have started by now, if not then you can start manually by clicking start button.
This worked for me!!
Simply goto your terminal and type:
sudo apachectl stop
It'll ask for password. Enter your system password.
Go back to XAMPP control panel and start Apache.
It should get started now.
I had the same Problem and fixed it by deleting the lib folder in Applications/XAMPP/xamppfiles/ and installing XAMPP again. It's probably due to old lib files from previous versions not being updated properly.
Another related issue, which I faced caused Apache sever failure. And failure logs is :
[Sun Jul 30 12:43:58.747822 2017] [unique_id:alert] [pid 9188] (EAI 8)nodename nor servname provided, or not known: AH01564:
unable to find IPv4 address of "MacBook-Pro.local" AH00016: Configuration Failed
To solve this :
Executed following command
sudo -e /etc/hosts
Then, changed following entries
127.0.0.1 localhost
::1 localhost
to
127.0.0.1 localhost MacBook-Pro.local
::1 localhost MacBook-Pro.local
I had the same issue when I update my XAMPP app, if you have to do this, you first have to uninstall your XAMPP (save your HTDOCS files in another folder, NOT in XAMPP folder, or you will lose it), and after that you can install the newest version of XAMPP. It worked for me, hope for you too.

XAMPP Apache is starts and then suddenly stops

I have windown 7 and XAMPP version 3.0. As today I start the XAMPP and try to start Apache in the status panel it displays
Status change detected: running
Status change detected: stopped
I checked error.log but no error is there.
1) go to config> apache (httpd.conf)
2) find "Listen 80" and change it to something like 8080 and save the file
3) click admin, it'll say "notfound"
4) in url after localhost write :8080 or the port number you wrote in httpd.conf
so it'll look like localhost:8080

Apache 2.4.3 (with XAMPP 1.8.1) not starting in windows 8

Just got XAMPP 1.8.1 installed on my Windows 8 PC, this version includes packages mentioned below:
Apache 2.4.3
MySQL 5.5.27
PHP 5.4.7
phpMyAdmin 3.5.2.2
FileZilla FTP Server 0.9.41
Tomcat 7.0.30 (with mod_proxy_ajp as connector)
Strawberry Perl 5.16.1.1 Portable
XAMPP Control Panel 3.1.0 (from hackattack142)
When I launched and tried to start Apache, it gave following error:
12:04:41 PM [Apache] Attempting to start Apache app...
12:04:41 PM [Apache] Status change detected: running
12:04:42 PM [Apache] Status change detected: stopped
12:04:42 PM [Apache] Error: Apache shutdown unexpectedly.
12:04:42 PM [Apache] This may be due to a blocked port, missing dependencies,
12:04:42 PM [Apache] improper privileges, a crash, or a shutdown by another method.
12:04:42 PM [Apache] Check the "/xampp/apache/logs/error.log" file
12:04:42 PM [Apache] and the Windows Event Viewer for more clues
After that I checked error.log, it was empty so no help from there.
So here is the solution for this:
I check port 80 used by Skype, after that I changes port to 81 and also along with that somewhere i read this error may be because of SSL Port then I changed SSL port to 444. However this got resolved easily.
One most important thing to notice here, all the port changes should be done inside config files, for http port change: httpd.conf for SSL httpd-ssl.conf. Otherwise changes will not replicate to Apache, Sometime PC reboot is also required.
Edit: Make Apache use port 80 and make Skype communicate on other Port
For those who are struggling with Skype, want to change its port and to make Apache to use port 80.
No need to Re-Install, Here is simply how to change Skype Port
Goto: Tools > Options > Advanced > Connection
There you need to uncheck Use port 80 and 443 as alternative for incoming connections.
That's it, here is screen shot of it.
I had the exact same error.
It was because i didn't run setup_xampp.bat
This is a better solution than going through config files and changing ports.
This problem may occur due to apache not getting required port (default is 80).
The port may be being used by other services.
For example: Skype also has default port 80.
Installing Skype and Apache both on same machine will cause conflict and hence Apache will not start.
Either, you change Skype port or change Apache port as described in following steps:
Change the ports of Apache and it will work for you.
Go to httpd.conf
How to change port for Apache:
Search for:
ServerName localhost:80
Change it to:
ServerName localhost:81
Also Search For:
Listen 80
Change it to:
Listen 81
If you have created any virtual hosts, change the ports there also.
Then restart your apache.
I had the same problem, but I understand the VMware service is the problem. VMware host service and Apache service conflict together.
To Solve it »
Run your task manager » in services tab find VMwareHostd » then right click and stop it » every thing have been solved.
Enter services.msc and shutdown anything SQL you have running.
The SQL server might be taking over the port.
I had the same problem and error, I tried changing the ports for http port from 80 to 81 and ssl port from 443 to 444 but still received the same error so I reverted the ports to default and ran setup_xampp.bat which solve the problem in seconds.
Skype is usually the culprit because it uses port 80 by default. Just close it or uncheck "Use port 80 and 443 as alternatives for incoming connections" under tools > options... > advanced > connection and then restart Skype.
I had to manually edit the 2 text files (httpd.conf and httpd-ssl.conf) using the Config button for Apache to run and change in notepad from 80 > 81 and 443 > 444
Using the Xampp UI config manager doesn't save the changes into Apache.
change 80 to 81 and 443 to 444 by clicking config button and editing httpd.conf and httpd-ssl.congf. Now you can Access XAMPP from 127.0.0.1:81
An error in your httpd.conf or other Apache config files will cause this. Revert httpd.conf et al to the pristine, installer versions and see if Apache runs again.
(I tried Skype and other suggestions here, no luck, but logs [XAMPP > Apache > Logs button] showed that it ran once when first installed. That was the giveaway.)
Likely errors:
Did you edit with a Windows text editor that changes line endings to non-Unix? (Solution here.)
Missing or invalid DSO files (.so)
I had this problem and then I ran "apache_start.bat" the error in german told me there was a problem with line 51 in httpd-ssl.conf which is
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
What I did was comment lines 163 (ssl module) and 522 (httpd-ssl.conf include) in httpd.conf;
I don't need ssl for development, so that solved it for me.

Localhost not working on XAMPP 1.7.7 for Windows 7

My xampp installation 1.7.7 does not seem to work. http://localhost returns search results on localhost
XAMPP instaled in C:\xampp
Xampp Control panel shows both mysql & apache service running fine.
Changed Skype internet connection settings (Tools-Options-Advanced-Connection panel and deselected the "Use 80 and 443 as alternatives for incoming connections")
I'am on windows 7.
Turned IIS off ( Control Panel-­System and Security-Administrative Tools-Internet Information Services Manager-Manage Server- Stop)
Thanks a lot.
As I saw this is common "problem" for Windows 7 and VIsta - in some cases these systems doesn't know 'localhost'.
Try use http://127.0.0.1 or add one line to file C:\Windows\System32\drivers\etc\hosts
This line is:
127.0.0.1 localhost
For me it was a different problem. The following fixed it for me. Thought I'd share
Open:
xampp/apache/conf/extra/httpd-vhosts.conf
And check the line:
DocumentRoot path/to/home/dir
For me this was pointing to default location so I had to change it to my custom location.
Restart Apache and you're done

Resources