Can't open files using localhost
Posted by: Red_Maple_Leaf (---.lightspeed.wlfrct.sbcglobal.net)
Date: July 17, 2013 02:24AM

Hi,

I downloaded WAMP Server about a month ago. I was able to create php files and open them using localhost. However, this time I downloaded the server again and tried to open the test files as well as my own files, but they both failed to open.

I made sure to turn on all services, and my WAMP Server icon is green.

When I try to open the two testing files "index" and "testmysql", I get the literal codes within the files on my browser. The addresses on the address bar for "index"is file:///C:/wamp/www/index.php and for "testmysql" is file:///C:/wamp/www/index.php. The same thing happens for my own file, for which the literal codes show up and the address is file:///C:/wamp/www/new%20%202.txt.

I know that the addresses are incorrect, because they need to begin with localhost. Last time I had WAMP Server, each working file that I ran had a "localhost" in front of its address following by the location on the computer.

For that reason, I tried add "localhost" to the address for the "index" file when running it. The exact address is [localhost]. This leads to a 403 Forbidden page, with the message "Forbidden. You don't have permission to access /file:///C:/wamp/www/index.php on this server."

Can you help me fix what's wrong here? Thanks a lot!

Options: ReplyQuote
Re: Can't open files using localhost
Posted by: RiggsFolly (---.as13285.net)
Date: July 17, 2013 09:51AM

Yes,

Use the browser to open these files, not a doubleclick on the filename in explorer.

In the browser address bar enter 'localhost' to run the index.php
In the browser address bar enter 'localhost/testmysql.php' to run that script.

To get the testmysql.php to run correctly you will need to change the script
'c:\wamp\qqq\testmysql.php'

Change this line from:
$link = mysql_connect('hostname','dbuser','dbpassword');

To:
$link = mysql_connect('localhost','root','');


This is assuming you have not changed the password for the default mysql username of 'root'.

Options: ReplyQuote
Re: Can't open files using localhost
Posted by: Red_Maple_Leaf (---.dia.static.qwest.net)
Date: July 17, 2013 07:19PM

Hi, thanks for the help! The problem is fixed now.

Options: ReplyQuote


Sorry, only registered users may post in this forum.