Page 1 of 1

Why won't this work???

Posted: Sun Sep 14, 2014 1:48 am
by kydude1957
I have a problem with running the following script in my index.php on Apache.

Code: Select all

<?php

include("includes/header.php");
include("includes/navbar.php");
include("includes/footer.php");
?>
If I put these back together in one index.php file it displays perfectly. However, if you run it the browser displays the code and thats all.

I have been through all the tweeks for includes according to the apache instructions. I have even tried it on another server that is not WAMP and it does the same thing. Can anyone help me please? Just trying to learn.

Re: Why won't this work???

Posted: Sun Sep 14, 2014 3:11 am
by requinix
What is the URL in the address bar when you "run it in the browser"? You tried it on another server how, exactly?

Re: Why won't this work???

Posted: Sun Sep 14, 2014 1:15 pm
by kydude1957
file://localhost/C:/wamp/www/MySite/test.php

is what shows up in WAMP. Tried it in EzPHP same thing. Both servers index.php and includes folder are in the root directory.

Re: Why won't this work???

Posted: Sun Sep 14, 2014 4:54 pm
by requinix
Yeah, can't do that.

You must be viewing the script through WAMP and not the filesystem. The URL will look something like

Code: Select all

http://localhost/MySite/test.php

Re: Why won't this work???

Posted: Mon Sep 15, 2014 11:52 am
by kydude1957
Changed it to this:

Code: Select all

<?php
include("http://localhost/MySite/includes/header.php");
include("http://localhost/MySiteincludes/navbar.php");
include("http://localhost/MySite/includes/home.php");
include("http://localhost/MySite/includes/footer.php");
?>

Re: Why won't this work???

Posted: Mon Sep 15, 2014 12:03 pm
by kydude1957
posted my changed script on the other post.

Re: Why won't this work???

Posted: Mon Sep 15, 2014 1:40 pm
by requinix
Remember a couple posts up when I asked you what the URL in your browser's address bar was? Then you replied? Then I said what you saw was wrong? I was still talking about the URL in your browser's address bar. The conversation did not suddenly revert to your code.

Change the code back to what it was before and point your browser to http://localhost/MySite/test.php.