Page 1 of 1

PHP not working

PostPosted: 22. October 2009 05:00
by thehodapp
I installed xampplite successfully on windows xp and everything seems to work. I am entirely offline--no internet. The xampp homepage comes up when I go to localhost just as it is supposed to. However when I put .php files into htdocs and try to open them in a browser, the php code does not work. It doesn't compile at all.

What is my problem?

Re: PHP not working

PostPosted: 22. October 2009 05:22
by Izzy
So http://localhost goes to the XAMPP Welcome page and you tested the demos on that page's menu - they are mostly php coded files?

What files did you put in the htdocs folder and after testing XAMPP above you deleted the index.php and the index.html that belong to XAMPP before adding your own files?

What did you type in the browser to access your php files?

BTW after deleting the XAMPP index files in the htdocs folder you can still access the XAMPP Welcome Page by typing in your browser:
http://localhost/xampp/

Re: PHP not working

PostPosted: 22. October 2009 18:27
by thehodapp
I didn't delete the index.php or the index.html files. I created a new folder inside of http://localhost/xampp/htdocs called mywebsite and wrote a .php file and clicked on it from windows explorer but the code does not work. I know that I wrote it correctly.

Re: PHP not working

PostPosted: 22. October 2009 19:29
by Wiedmann
and clicked on it from windows explorer but the code does not work.

You can't click on a *.php file. You must open it through the server with "http://".

Re: PHP not working

PostPosted: 22. October 2009 23:12
by Izzy
thehodapp wrote:I created a new folder...called mywebsite and wrote a .php file and clicked on it from windows explorer but the code does not work. I know that I wrote it correctly.
You can click on a *.php file if you have associated the php file extension with your php code editor or any text editor like notepad for example.

To see how the php code works after editing or creating the code then the Apache server has to parse the code.

So in your case if you type in your browser http://localhost/mywebsite/myphpfile.php then it will show you the results of your php creation.

Good luck.