Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening a php file with 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?

like image 987
BrownBoii333 Avatar asked Oct 31 '17 03:10

BrownBoii333


People also ask

How do I open a PHP file?

Go to the location of your PHP file, then click the PHP file to select it. Click Open. It's in the bottom-right corner of the window. This will open the PHP file in Notepad++, allowing you to view the file's code and make any necessary edits.

Can PHP run on XAMPP?

To run PHP for the web, you need to install a Web Server like Apache and you also need a database server like MySQL. There are various web servers for running PHP programs like WAMP & XAMPP. WAMP server is supported in windows and XAMP is supported in both Windows and Linux.


Video Answer


2 Answers

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

like image 154
acoder Avatar answered Oct 15 '22 18:10

acoder


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

like image 22
dianeryanto Avatar answered Oct 15 '22 18:10

dianeryanto