Have you tried:
$hostname_localhost = "localhost";
That should work fine assuming you have uploaded the localhost.php file to your server.
[With mine, while I'm testing on my local machine, I use:
$hostname_localhost = "www.mydomain.com"; (mydomain is my domain name)
I'm able to use that on my local machine because I have set my username in mySql preferences in my control panel to allow % - which is a wildcard symbol means that it will accept connection from any source.]
But just localhost should be fine for a page that's been uploaded.