HTML and PHP files won't work

Problems with the Windows version of XAMPP, questions, comments, and anything related.

HTML and PHP files won't work

Postby marlon » 13. August 2009 13:38

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.
marlon
 
Posts: 6
Joined: 13. August 2009 13:23

Re: HTML and PHP files won't work

Postby Wiedmann » 13. August 2009 14:16

What happens if you just go to "http://localhost/" or ""http://localhost/xampp/"?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: HTML and PHP files won't work

Postby marlon » 13. August 2009 14:25

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.
marlon
 
Posts: 6
Joined: 13. August 2009 13:23

Re: HTML and PHP files won't work

Postby Sippan » 13. August 2009 14:30

try put that files in httdocs instead like here C:\xampp\htdocs

http://localhost/yourfoldername/index.html

for example
Sippan
 
Posts: 12
Joined: 13. August 2009 10:29

Re: HTML and PHP files won't work

Postby Wiedmann » 13. August 2009 14:40

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?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: HTML and PHP files won't work

Postby marlon » 13. August 2009 14:50

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.
marlon
 
Posts: 6
Joined: 13. August 2009 13:23

Re: HTML and PHP files won't work

Postby Sippan » 13. August 2009 14:56

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
Sippan
 
Posts: 12
Joined: 13. August 2009 10:29

Re: HTML and PHP files won't work

Postby marlon » 13. August 2009 15:14

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.
marlon
 
Posts: 6
Joined: 13. August 2009 13:23

Re: HTML and PHP files won't work

Postby Wiedmann » 13. August 2009 15:39

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?)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: HTML and PHP files won't work

Postby marlon » 13. August 2009 15:50

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.
marlon
 
Posts: 6
Joined: 13. August 2009 13:23

Re: HTML and PHP files won't work

Postby Wiedmann » 13. August 2009 16:09

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
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: HTML and PHP files won't work

Postby marlon » 13. August 2009 16:17

I think I get it.

Thanks.
marlon
 
Posts: 6
Joined: 13. August 2009 13:23


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 34 guests