Reputation: 169
I'm very new to web development and I'm trying to create a php contact form. I'm trying to launch it on a xampp development server, but I can't seem to figure out how. according to this site, I need to type localhost then some options of files should show up. Well it doesn't, the xampp dashboard just shows up, and my files are in the htdocs folder. Am I opening them wrong or whats happening, I've been stuck on this for hours?
Upvotes: 10
Views: 105472
Reputation: 19
You need to either:
for option 2 you need to find "C:\xampp\htdocs\index.php" and:
<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/myCode.html');
exit;
?>
Something is wrong with the XAMPP installation :-(
I hope this helps, this is my first comment on a question, i believe the initial code is:
<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/index.html');
exit;
Something is wrong with the XAMPP installation :-(
?>
Upvotes: 0
Reputation: 1
First of all, make sure that you don't have a file have the name "index" under htdocs folder. Then :
Done! You will find all files that exists on htdocs folder.
Note : I proposed to use incognito to avoid cookies problem.
XAMPP open files named index as default files ( You can change that setting ) .
Upvotes: 0
Reputation: 538
first check xampp is installed or not.
check the Apache service is started or not.
save your filename.php
file in "xampp/htdocs/**filename.php**"
Access your php file. localhost/filename.php
If your php file is in folder than : localhost/foldername/filename.php
Upvotes: 0
Reputation: 759
First you need to start XAMPP. So, go to the drive where you install the XAMPP server. Generally, it's installed in C
drive. So, go to C:\xampp\
. And open the file xampp-control.exe
. When the controller open you need to start the Apache
and Mysql
. Then you see the green color besides Apache
and Mysql
. It means they are running or started. OK.
Now, go to C:\xampp\htdocs
and create a folder as you want. For an example you can create folder which name is hello
. Then open this folder and create a file which name is index.php
and open it in you editor write a basic code like this:
<?php
echo "Hello World";
?>
Then save it. And open your browser. And go to localhost/hello
hello
means the folder name you created.
Now, you will see the output. Which showing Hello World
Feel free to asking any question. Happy Coding!!
Upvotes: 25
Reputation: 600
make sure your apache service on your XAMPP is running, if you using database, activate mysql too.
and save your file in C:\xampp\htdocs
if your file index.php, you can access it as localhost/index.php
if you make folder inside htdocs like C:\xampp\htdocs\test
you can access it as localhost/test/index.php
Upvotes: 4