Page 1 of 1

HTML works, php does not.

PostPosted: 18. July 2010 04:15
by rayburrell
I have recently downloaded xampp for windows 1.7.3, and installed it on my windows xp machine. xampp seems to be working fine. When I go to http://localhost it takes me to the main xampp page where I can review everything. I can open a html file, but not a php file. Even a simple php file will not load. When I go to open a php page, I get the following error:

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
7/17/2010 10:14:00 PM
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

The php file I have made is simple like this:

<?php
echo "Hello World";
?>

Any help would be appreciated.

Thanks,

Ray

Re: HTML works, php does not.

PostPosted: 18. July 2010 11:12
by Altrea
In which directory do you save this php file?
What URL do you type in do request this page?

Re: HTML works, php does not.

PostPosted: 19. July 2010 01:24
by rayburrell
I have the file located in the following directory:

D:\programming\Xampp\xampp\htdocs\test.php

I am trying to open it wit the following url:

http://localhost/test.php

I have a html file in the same directory named index.html, and it opens fine with the following url:

http://localhost/index.html

Thanks,

Ed.

Re: HTML works, php does not.

PostPosted: 19. July 2010 10:39
by Nobbie
rayburrell wrote:D:\programming\Xampp\xampp\htdocs\test.php


I think its the standard problem of Notepad and Explorer. If you created the file with Notepad, its actually NOT called test.php but test.php.txt - and Explorer suppresses the *.txt extension as it is configured per default to suppress known file type extensions.

Change the folder settings of Explorer in order to view the real full file name (including all extensions) and you will see, if it is test.php or test.php.txt and rename the file if necessary.

Re: HTML works, php does not.

PostPosted: 19. July 2010 14:20
by rayburrell
I double checked, but unfortunately that's not the problem.

I used programmer's Notepad to write the code, and have looked at explorer as well. My settings do not indicate that it should hide extensions for known file types, and the file type in the menu is .php. Also went to a command prompt and did a directory of htdocs to verify. the test file is .php extension.


Thanks,

Ed.

Re: HTML works, php does not.

PostPosted: 19. July 2010 15:55
by JonB
I have recently downloaded xampp for windows 1.7.3, and installed it on my windows xp machine. xampp seems to be working fine. When I go to http://localhost it takes me to the main xampp page where I can review everything.


If you can dispaly the 'xampp' page - PHP is working (did you also try using the phpinfo() page?). I say this without fear of contradiction, as the 'xampp' page is actually 'http://localhost/xampp/index.php'.

So we are either dealing with a page syntax problem, or a problem with the htdocs folder. By any chance have you added a .htaccess file to the root of htdocs or made changes to the Apache .conf files ??? One more question - where is XAMPP installed on the machine?

:?:

A simple test would be to copy the existing phpinfo.php from the \htdocs\xammp folder into the root \htdocs folder and see if it will execute correctly. If it does; page problem, if it doesn't; folder problem.

:shock:

Re: HTML works, php does not.

PostPosted: 19. July 2010 17:20
by rayburrell
Ok, now I feel really dumb...

It appears that xampp placed the installation on both my C and D drives... :oops:

If I place the file under htdocs on the c drive installation, it works fine. I'm a little confused how it happened, but at least it is working.

Thanks for all the help!

Ed.