SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Database driven website pg 82 book copyright 2009

    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.

    Help please? thanks, emagify

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Is the file extension actually .htm, rather than .html?
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,048
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    The mark-up for the HTML page is
    HTML Code:
    <!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&rsquo;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.

  4. #4
    SitePoint Member
    Join Date
    Jun 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The file is .html

  5. #5
    SitePoint Member
    Join Date
    Jun 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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"."

    Appreciate your attempts to help me. mark

  6. #6
    SitePoint Member
    Join Date
    Jun 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for the slower response, lost the momentum of helpers. Any ideas to help me

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,048
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    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.

    page1.html
    HTML Code:
    <html><head><title>page1</title></head>
    <body>
    <a href='page2.html'>page 2</a>
    </body></html>
    page2.html
    HTML Code:
    <html><head><title>page2</title></head>
    <body>
    <a href='page1.html'>page 1</a>
    </body></html>
    But absolute links with the "http" need to go to a server.

    AFAIK that should be the right "htdocs" folder (there should be only one),

    Maybe you need to use a port? But as the PHP file is OK I doubt that.

    Try starting the server and pointing your browser to
    http://127.0.0.1/welcome1.html

    And double check spelling and case. Welcome is not the same as welcome

  8. #8
    SitePoint Member
    Join Date
    Jun 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help. Spelling was correct. I put them in the www folder under wamp and it worked fine.

    Just don't know why under www it worked but not under the main wamp or under htdocs?

    thank you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •