Page 1 of 1

Error with PHP and XAMPP installation

PostPosted: 16. December 2010 12:46
by chickensoup64
Hi!

I'm new to all this but I'm trying to learn php and sql so I downloaded XAMPP and installed it following all the prompts and when I open the default index.php file I get the below result. Any ideas why this isn't working?

Code: Select all
<?php
   if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
      $uri = 'https://';
   } else {
      $uri = 'http://';
   }
   $uri .= $_SERVER['HTTP_HOST'];
   header('Location: '.$uri.'/xampp/');
   exit;
?>
Something is wrong with the XAMPP installation :-(


I have both Apache and MySQL as 'Running' with the green background on the XAMPP Control Panel. I have no idea if I was meant to install any extra programs prior to this because I thought that just installing XAMPP would install everything I needed.

My computer is Windows XP SP3 and I'm not sure what else you guys would need to know, but please ask. Once again I'd like to stress that this is my first encounter with php so I'm not really sure what to do as far as installation goes.

Any help would be great.

Cheers
Ash

Re: Error with PHP and XAMPP installation

PostPosted: 17. December 2010 07:46
by chickensoup64
wole wrote:Try this:
http://localhost


Yup that page works and so do all the pages from there. Still index.php and all .php files won't work

Re: Error with PHP and XAMPP installation

PostPosted: 17. December 2010 08:36
by Sharley
chickensoup64 wrote:Yup that page works and so do all the pages from there. Still index.php and all .php files won't work
Can you please explain what you mean by they won't work?

All .php pages must be parsed by the server and will not display correctly just by double clicking on them, as is indicated when you used a URI to access them through the server - that is the nature of php, they must be handled or parsed by the server.

If you want to edit or read a php file then associate .php file extensions with your text editor or dedicated code editor and then they will open in that editor by double clicking on them.

Re: Error with PHP and XAMPP installation

PostPosted: 22. December 2010 23:39
by herhubby
All .php pages must be parsed by the server and will not display correctly just by double clicking on them


I just installed XAMPP in an effort to test out my PHP pages on my own machine. Everything seems to work fine for the localhost command you described, but HOW do I test my own PHP pages if I don't just click on them?

Sorry, I'm a total newbie.

Thanks,

Anthony

Re: Error with PHP and XAMPP installation

PostPosted: 23. December 2010 00:07
by Altrea
Therefor you have the Alias localhost which is a simple DomainName for your loopack IP 127.0.0.1.

e.g:
Assumed you have placed your php-files into a subfolder of your htdocs folder (your htdocs folder is the documentRoot folder of your Apache webserver. DocumentRoot means thats the place where apache starts to look for requested files to serve them). You can request them with the URL http://localhost/subfolder/filename.php
If you have two subfolders, thats like the same http://localhost/subfolder/subfolder/filename.php

so, localhost (respectively your local/public IP in combination with the Port on which Apache is listening) is routed to your DocumentRoot Folder

Re: Error with PHP and XAMPP installation

PostPosted: 27. December 2010 12:59
by chucky1234
hi 'ime also newbie
installed and tried http://localhost and http://127.0.0.1 but my broser says page not available
can anyone please help me, thanx :-) :(

Re: Error with PHP and XAMPP installation

PostPosted: 27. December 2010 13:53
by WilliL
did you started apache in XAMPP panel?

Re: Error with PHP and XAMPP installation

PostPosted: 27. December 2010 14:42
by chucky1234
hi Wilil
i did ya, was that wrong?
thanx a lot for helping :-) much appreciated
:lol:

Re: Error with PHP and XAMPP installation

PostPosted: 27. December 2010 15:25
by herhubby
Altrea wrote: You can request them with the URL http://localhost/filename.php
localhost is routed to your DocumentRoot Folder


Excellent, thanks. I changed the DocumentRoot setting to the folder my files are saved in and all is working well with localhost.

Take care,

Anthony