Jump to content

XAMPP Installation PHP Error

- - - - -

  • Please log in to reply
4 replies to this topic

#1
V o i D a S s

V o i D a S s

    Newbie

  • Members
  • Pip
  • 1 posts
I installed XAMPP on my computer to try out some PHP coding and when I open my index.php file this error appears on the web page:



<?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 :-(


But when I open the index.html file, the web page says:

 IT WORKS!

Has anyone had this error before?

#2
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
Are you sure apache is loading the good directory?

#3
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#
There is nothing wrong with your installation. what happens is that if somethings not right, the index.php shows the text "Something is wrong with the XAMPP installation :-(", but if it suceeds, it takes you to /xampp directory. Everything is depending on the "exit;" php command in end of the code, if it run the exit, the "Something..." is never shown.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Hello,

I believe your issue is that you are not viewing the page through the web server's IP/host address, but directly, and not interpreted.

Try to type in http://localhost/index.php (dependent on index.php being within the server's root folder, i.e. htdocs, or www) and see if that redirects you to the "it works" HTML page, generally that is the main issue you would see in those installations.

Alexander.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#5
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Yes you see your looking at the source code, this code is processed when you visit http://localhost/ the text at the bottom is only shown if the PHP code isn't executed (the PHP code redirects you to https://localhost/xampp/ before the text below it is shown).
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users