How to run PHP code in XAMPP?

Home > PHP > How to run PHP code in XAMPP?

How to run PHP code in XAMPP?

In this tutorial we well see, how to execute PHP code in local server using XAMPP. in windows local system. For that we have to follow the following steps to run PHP Code or PHP Script.

  • Install the XAMPP in Local System :  To install XAMPP in your localsystem we have to download it from the official website of XAMPP Server : https://www.apachefriends.org/download.html
  • After installing the xampp, we have to start Apache service to execute code in server in our local system and also start MYSQL server if Required.
  • In the Next Step we have to create sub directory in `xampp/htdocs`. In this tutorial we will create direcctory named `php-code`.
  • In this directrory, We will create one file named `index.php` and write php code init.

Add the following code in created php file

For executing php script in server, file extension must be `.php`. In this tutorial we have created file name `index.php`

<?php 

echo "Hello World";

?>

To execute this file in localserver. we have to open browser and run the following URL :

`http://localhost/php-code`

From the above code we will see the `Hello World` in our browser.

Write Your comment bellow. We will contact you soon.

Related Posts

PHP Introduction

PHP Introduction

Introduction : PHP stands for "Hypertext Preprocessor". It's original name was "Personal Home Page". PHP is the scripting language which is used to create dynamic web p

Subscribe to our newsletter

Stay up-to-date about latest Tutorial and Posts. Unsubscribe at anytime!