Home Internet Run PHP On Local Server Using XAMPP

Run PHP On Local Server Using XAMPP


What is PHP

PHP stands for Hypertext Preprocessor . It is a open source general-purpose scripting language . PHP is suitable for web development and it can be embedded into HTML .

PHP is server side scripting language , so it can’t run on local computer without any server . It means if you create a PHP code you can’t check the code results without any server like HTML .

To run php code on local server you have some minimum requirements .

  • One local server such and IIS7 or Apache
  • Database such as MySql database
  • PHP code editor such as notepad , notepad ++ , Dreamweaver

Xampp is one solution to install apache server and mysql database . So first step is download and install XAMPP .

Steps to Run PHP on XAMPP

To run php on XAMPP you need some simple steps . First step is , install XAMPP on computer and run XAMPP control panel .

Xampp control panel
Xampp control panel

Check your localhost is working

To check that your local server is working , Go to your web browser .

READ ALSO : -  What Is HTTP or Hypertext Transfer Protocol
Xampp localhost server
Xampp default page

Type http://localhost in web browser and hit enter button . If XAMPP is installed and working well then xampp default page is displayed .

Create PHP File

Create a sample .php file in notepad++ or any php creator . Copy the following code in notepad and save it as sample.php file . Save sample.php file on xampp> htdocs folder .

echo "Hi, I'm a PHP script!";

Save PHP File under htdocs Folder

Suppose you installed XAMPP on c drive . Go to c: drive , then go to xampp folder . Find htdocs folder under xampp folder . Create a new folder name mywebsite .

Save sample.php under mywebsite folder . Type the address in your address bar http://localhost/mywebsite/sample.php and run .

Know your php page is running of your local xampp server .

Video Help

For more details see the video