How can i edit php file in xampp?

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?

asked Oct 31, 2017 at 3:18

8

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!!

answered Oct 31, 2017 at 5:28

acoderacoder

6995 silver badges19 bronze badges

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

answered Oct 31, 2017 at 5:07

How can i edit php file in xampp?

dianeryantodianeryanto

5722 gold badges5 silver badges16 bronze badges

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

answered Oct 31, 2017 at 5:30

How can i edit php file in xampp?

First of all, make sure that you don't have a file have the name "index" under htdocs folder. Then :

  1. Lanch xampp-control.exe ( you will find it under XAMPP folder )
  2. Start Apache and MySql
  3. Open the browser in private (incognito).
  4. Write as URL : localhost.

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 ) .

answered Sep 9, 2020 at 0:26

You need to either:

  1. Delete 'index.php' or
  2. Edit 'index.php' so it runs your code on startup

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

answered Jan 22, 2021 at 15:41

How can i edit php file in xampp?

This maybe works.

Go to "http://localhost/xampp/".

answered May 27 at 11:06

1

Not the answer you're looking for? Browse other questions tagged php xampp localhost or ask your own question.

How can I access PHP file in XAMPP?

How to Run a PHP Code Using XAMPP?.
Go to “C:\xampp\htdocs” and inside it, create a folder. ... .
Inside the demo folder, create a new text file and name it “index. ... .
Now, to see the script output, open the XAMPP control panel and start Apache to host the local webserver, where our script will be running..

How do I edit a PHP file?

You can edit PHP files in any word processor or text editor, but word processors aren't designed to edit programming code. Instead, use a text editor with support for syntax highlighting, automatic indentation and bracket completion to efficiently edit PHP files.

Where can I edit PHP files?

A PHP file is a plain text file, so you can open it in any text editor like VI, Notepad, or Sublime Text. For beginners, tools like Notepad++ should do, since they'll just be running small snippets of code.

Where are PHP files stored in XAMPP?

Note: PHP program must be saved in the htdocs folder, which resides inside the xampp folder, where you installed the XAMPP. Otherwise it will generate an error - Object not found.