I’m running WAMP , PHP 5.3.0, MYSQL 5.1.36 and APACHE 2.2.11
The first excercise using today.php worked fine. I type into my browser -> http://localhost/today.php and I get the desired result i.e. date shows up. But for the welcome1.html , which is in my the C:\WAMP\ directory just like ‘today.php’, I type into my browser http://localhost/welcome1.html and it returns with a 404 error, page not found. Since the stuff I typed in wasn’t working I am using exact copies of what’s in your code archive.
Not sure what I’m doing wrong?
I can go through explorer and click on the html file and it works, kinda, but when I click on the link (Hi my name is kevin) it just brings me to a “file///c:/wamp/welcome1.php…” . From reading other customers’ issues on this I realize you can’t click on the link from explorer.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Query String Link Example</title>
<meta http-equiv="content-type"
content="text/html; charset=utf-8"/>
</head>
<body>
<p><a href="welcome1.php?name=Kevin">Hi, I’m Kevin!</a></p>
</body>
</html>
The link is a “relative” link (as opposed to “absolute” like your type into the address bar).
Because its a relative link and you’re going to it through your OS it looks for it as a “file” instead of “http”.
Because you’re getting
“file///c:/wamp/welcome1.php…”
I’m guessing you put the file directly under the WAMP app folder instead of under the htdocs folder.
When you sart up the server and go to a localhost HTTP address, it does NOT look in the main WAMP app folder, but goes directly to the htdocs folder.
I put both files (welcome1.php and welcome1.html; the html file calls the php file) in the htdocs folder (wamp/bin/apache/apache2.2.11/htdocs). Then I tried to run it by typing http://localhost/welcome1.html . It still gives me the 404 file not found error.
Is that the right htdocs folder?
Not sure what you mean by “Because its a relative link and you’re going to it through your OS it looks for it as a “file” instead of “http”.”
Relative links will work in a web page with Windows explorer and IE.
eg. if you put these on your computer in any folder anywhere and click on them to open.