Error with PHP and XAMPP installation

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

Error with PHP and XAMPP installation

Postby chickensoup64 » 16. December 2010 12:46

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
chickensoup64
 
Posts: 2
Joined: 16. December 2010 12:26

Re: Error with PHP and XAMPP installation

Postby chickensoup64 » 17. December 2010 07:46

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
chickensoup64
 
Posts: 2
Joined: 16. December 2010 12:26

Re: Error with PHP and XAMPP installation

Postby Sharley » 17. December 2010 08:36

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.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Error with PHP and XAMPP installation

Postby herhubby » 22. December 2010 23:39

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
herhubby
 
Posts: 2
Joined: 22. December 2010 23:32

Re: Error with PHP and XAMPP installation

Postby Altrea » 23. December 2010 00:07

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error with PHP and XAMPP installation

Postby chucky1234 » 27. December 2010 12:59

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 :-) :(
chucky1234
 
Posts: 2
Joined: 27. December 2010 12:18

Re: Error with PHP and XAMPP installation

Postby WilliL » 27. December 2010 13:53

did you started apache in XAMPP panel?
Willi
WilliL
 
Posts: 660
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: Error with PHP and XAMPP installation

Postby chucky1234 » 27. December 2010 14:42

hi Wilil
i did ya, was that wrong?
thanx a lot for helping :-) much appreciated
:lol:
chucky1234
 
Posts: 2
Joined: 27. December 2010 12:18

Re: Error with PHP and XAMPP installation

Postby herhubby » 27. December 2010 15:25

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
herhubby
 
Posts: 2
Joined: 22. December 2010 23:32


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 111 guests