Zaptagious Posted January 22, 2011 Share Posted January 22, 2011 How do I know if localhost is working or not? I think I might have this problem too by reading the posts here, I'm using XAMPP 1.7.3. I don't know what's supposed to happen or what isn't, but when i go to http://localhost it goes straight to the XAMPP interface. Reason I'm wondering is because I've tried doing a login script from a tutorial ( ) but I get "Couldn't connect" with it after putting in correct username and password, and I'm assuming it's localhost that's bugging cause I did everything like in the tutorial. Here's the script for the 2 php files: <html> <form action='login.php' method='POST'> Username: <input type='text' name ='username'><br> Password: <input type='password' name ='password'><br> <input type='submit' value='Log in'> </form> </html>> <?php $username = $_POST['username']; $password = $_POST['password']; if ($username&&$password) { $connect = mysql_connect("localhost","root","") or die("Couldn't connect"); mysql_select_db("logintest") or die("Couldn't find database"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows ($query); echo $numrows; } else die("Type in username and password"); ?> I'm a beginner at this, any help would be appreciated Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/ Share on other sites More sharing options...
Pikachu2000 Posted January 22, 2011 Share Posted January 22, 2011 If you're getting the XAMPP splash page, then it's operating as it's supposed to. What do you mean you couldn't connect? The exact error would be useful here . . . Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163650 Share on other sites More sharing options...
Zaptagious Posted January 22, 2011 Author Share Posted January 22, 2011 Ah so it created a new thread, ok now I know that Sorry, I'm as much of a beginner as possible. What I mean by not being able to connect I refer to this piece of string in the second script I posted: $connect = mysql_connect("localhost","root","") or die("Couldn't connect"); Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163651 Share on other sites More sharing options...
Pikachu2000 Posted January 22, 2011 Share Posted January 22, 2011 No, I actually split the post off of the old thread. People tend to ignore old threads that are dredged up. While in development, change the MySQL connection code so it returns the actual error instead of a generic 'Couldn't connect" error message. $connect = mysql_connect("localhost","root","") or die( mysql_error() ); Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163654 Share on other sites More sharing options...
Zaptagious Posted January 22, 2011 Author Share Posted January 22, 2011 Now it says: Access denied for user 'root'@'srv200.one.com' (using password: NO) and I'm none the wiser.... I really appreciate the help by the way Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163660 Share on other sites More sharing options...
Pikachu2000 Posted January 22, 2011 Share Posted January 22, 2011 You don't have a password set up for you database server? Where is srv200.one.com coming from? Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163665 Share on other sites More sharing options...
Zaptagious Posted January 22, 2011 Author Share Posted January 22, 2011 You don't have a password set up for you database server? Appearantly not, I just pretty much installed it and started with the tutorial... Well, I have a password for the actual website that I got from my webhotel one.com but not sure if that's the same thing... Where is srv200.one.com coming from? you're asking me? well I know one.com is the webhotel I'm using, but as for the srv200 part, no clue. Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163668 Share on other sites More sharing options...
Pikachu2000 Posted January 22, 2011 Share Posted January 22, 2011 What do you get if you go to http://localhost/phpMyAdmin/? Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163672 Share on other sites More sharing options...
Zaptagious Posted January 22, 2011 Author Share Posted January 22, 2011 Object not found! The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again. If you think this is a server error, please contact the webmaster. Error 404 localhost 2011-01-22 20:09:30 Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163678 Share on other sites More sharing options...
Pikachu2000 Posted January 22, 2011 Share Posted January 22, 2011 Is there a link to phpMyAdmin on the XAMPP splash page you get when you go to http://localhost? If there is, try that link and see if it works. Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163683 Share on other sites More sharing options...
Zaptagious Posted January 22, 2011 Author Share Posted January 22, 2011 It didn't work at first but after a computer reboot it's working Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1163689 Share on other sites More sharing options...
Zaptagious Posted January 23, 2011 Author Share Posted January 23, 2011 well phpMyAdmin that is... Still having problems connecting through my login script. I set up passwords for XAMPP, MySQL admin user root and PhpMyAdmin, but I'm still getting: Access denied for user 'root'@'srv200.one.com' (using password: NO) I restarted MySQL and cleared cache on my internet browers... Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1164012 Share on other sites More sharing options...
ttocskcaj Posted January 31, 2011 Share Posted January 31, 2011 You're not trying to connect to your local mysql server (the one that comes with XAMPP). You're trying to connect to a remote one. (srv200.one.com) If you want to use one.com's MySQL server, ask them what the password should be. And check that they allow you to access it from a remote address. (Lots only let you use it from their servers) Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1167808 Share on other sites More sharing options...
rabeeshm Posted April 13, 2011 Share Posted April 13, 2011 MY localhost not working.am checking my host file it contain 127.0.0.1 localhost ::1 localhost 127.0.0.1 example.oi 127.0.0.1 example.oi these lines.I also created virtual hosts for my projects.When am trying to run my localhost it automaticaly redirect to first virtual host.Anybody can help me.I changed my working directory from c to another drive and xampp installed also in that directory.All virtual hosts are working but localhost not working please help me Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/225335-localhost-not-working/#findComment-1200995 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.