I have installed Apache2.2 on my computer, PHP 5, and MySQL. Everything was working fine until last night. Suddenly, I could no longer connect to the localhost. I think my computer was infected with a trojan, but that has since been removed and I am unable to reconnect to my localhost.
I have updated my hosts file Windows(C:)/Windows/System32/drivers/etc hosts in notepad: see attachment.
I have tested my connection in the CMD prompt see attachment.
You'll notice [::]1, but after updating my host file, it now displays as 127.0.0.1
Additionally, port 80 IS LISTENING
instead of my web browser loading the page as localhost/vote/home.php NOW it loads as file:///C:/Websites/Vote/home.php AND NOW my PHP no longer works i.e. not being pulled into my web page.
...can't establish a connection to the server at localhost.
Why is my local host not working? Thoughts? Thank you in advance.
Additionally, my web browser page does not time out when requesting localhost....
(I'm a new user so I am unable to post images)?
× 257296
if you put localhost/vote/home.php into your browser's address bar you should get an unabled to connect error, not a redirect to a file. The only time the address bar will show file:///C:/Websites/Vote/home.php is if you open that file directly in your browser.
Your details about why apache isnt working are not to clear, but you can try a couple of things. First, how did you install apache, is it a service? you can check this by going to control panel > Administrative Tools > Services and see if apache is in that list. If its, you have to start it, if its not then apache is not installed as a service and you need to start it by running the executable. Go to the whichever directory your httpd executable is and run it.
Some things to try:
Check if it's listening to the expected port (80, or whatever you have configured it to)
> netstat -nb
Check your hosts file to make sure nothing fishy is going on there. localhost
should point to 127.0.0.1, but maybe it's been set to point somewhere else by your virus thing.
If you can't figure it out, you can always try to remove/uninstall and try to set it up again. If this is a developer machine, I can recommend using the WAMP package installer instead of setting it all up yourself. It provides fairly easy switching between php/apache/mysql versions and easy switching on and off of most regular apache and php modules.
run command prompt as administrator and go to Apache bin folder (usually 'cd \apache\bin' ) and type httpd -k start. it worked for me with the same issue.
I had the exact issue. If you have a XAMPP control panel pull it up. There you will see XAMPP Control Panel Image the different modules that you have open... Apache will be one of them. In the 'Actions' column you will have 'Stop' adjacent to it. Hit the 'Stop' and wait about 1 minute for everything to calm down. The button will change to 'start' so hit it. This will reset Apache. It worked for me...Good Luck. If you don't have the control panel on your desktop, go into your programs list and drop-down the XAMPP icon. The control panel is right there. Just click it and it will show