Page 1 of 1

HTML and PHP files won't work

PostPosted: 13. August 2009 13:38
by marlon
Hello Everyone,

I am using xampp version 1.7.1 on Windows Vista and have discovered the following problem.

I have created a new folder inside the xampp folder for testing purpose and created a basic php info file:

<?php phpinfo(); ?>

and also a very very basic html file. The problem is that neither of these files work when I type in http://localhost...etc I just receive the message that the Object was not found Error 404. According to the xampp control panel both Apache and MySQL are running and when I type localhost into the browser everything shows up as working correctly. To make sure it wasn't just my files I tried to view an HTML file that came with the xampp install and this didn't work either. At this stage I'm not sure how to resolve this. Any help you can give will be much appreciated.

Many thanks in advance.

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 14:16
by Wiedmann
What happens if you just go to "http://localhost/" or ""http://localhost/xampp/"?

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 14:25
by marlon
Thanks for the reply.

If I go to http://localhost/xampp it works absolutely fine and the status shows that everything is fine this is why I'm a bit confused with it. To be honest it wouldn't surprise me if Vista has a hand in this somehow.

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 14:30
by Sippan
try put that files in httdocs instead like here C:\xampp\htdocs

http://localhost/yourfoldername/index.html

for example

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 14:40
by Wiedmann
If I go to http://localhost/xampp it works absolutely fine

OK, if the XAMPP files are working fine, what did you mean with this statement:
marlon wrote:I tried to view an HTML file that came with the xampp install and this didn't work either.

Or, how have you tried to view this file? And which file exactly?

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 14:50
by marlon
Thanks.

I tried to view an html file that came with xampp by typing in the following path:

http://localhost/xampp/htdocs/index.html

If I go to this index.html file in the htdocs file and just double click it, it works fine but it is just running directly from the hard drive and not through the server.

Again http://localhost/xampp shows that everything is working correctly but this seems not to be the case.

I hope I'm not frustrating you. Thanks for your patience.

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 14:56
by Sippan
use this so will it work....dont typ xampp or htdocs after localhost

http://localhost/index.html
will show u it works hehe

but if u put in a folder in htdocs for example make a folder whit name test so will u use this adress

http://localhost/test/index.html

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 15:14
by marlon
That was incredible. It worked! I don't know why though. Is it important to know the reason why this now works and didn't before?

Many many thanks for your help and actual solution.

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 15:39
by Wiedmann
Is it important to know the reason why this now works and didn't before?

Not really. If you use a wrong URI to access something, the Apache can't find it. That's all.

That's more important:
Have you understand, how a URI is translated to a filesystem path?
(or are you still accessing your files with a try 'n error method?)

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 15:50
by marlon
Thanks.

The only thing I think I didn't understand is why this path works:

http://localhost/index.html

and this one didn't:

http://localhost/xampp/htdocs/index.html

I'm sure there's a simple explanation and all I'm trying to do is learn which I think includes all of us albeit at different levels.

Thanks again.

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 16:09
by Wiedmann
why this path works: http://localhost/index.html

Code: Select all
http://localhost/           --> C:\xampp\htdocs
http://localhost/sub1/      --> C:\xampp\htdocs\sub1
http://localhost/sub1/sub2/ --> C:\xampp\htdocs\sub1\sub2



Code: Select all
http://localhost/xampp/htdocs/index.html    becomes    C:\xampp\htdocs\xampp\htdocs\index.html

Re: HTML and PHP files won't work

PostPosted: 13. August 2009 16:17
by marlon
I think I get it.

Thanks.