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!!
Answer from acoder on Stack OverflowFirst 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!!
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
Does PHP only work inside C:\xampp\htdocs with a localhost?
Opening /running PHP files in Mac
XAMPP can't read my Javascript in my PHP file, but it will when it's HTML?
src="scripts.js"
The most likely reason for this is that 'scripts.js' isn't in the right place when you access this file.
-
Learn to use Dev Tools
-
XAMPP can't read your javascript? No. XAMPP is the package/framework. Your browser can't read your javascript and the browser is the best place to find out why.
XAMPP - index.html -> index.php
Can we run PHP in XAMPP?
Q1. How to run PHP file in XAMPP on Windows?
Q8. Why is my PHP file not running in XAMPP?
Videos
If I try to put a php file inside any other location other than whats listed in the title, it just shows the code and doesnt execute it. Is there a way around this?