Open In App

How to execute PHP Script in Website using XAMPP webserver ?

First we have to install the XAMPP/WAMP webserver in our system. Please follow the link to download and install XAMPP/WAMP server. Link https://www.apachefriends.org/download.html

After successful installation, the steps we should follow are-



Xampp starts




<?php
echo "Geeks for Geeks";
?>



Note: If there are multiple files in your code similarly then you can put all your files in one folder and can run it.




<?php 
  
// Declare the variable
$x = 20;  
$y = 10;  
  
// Evaluate arithmetic operations
$z = $x + $y
$m = $x - $y;
$p = $x * $y
$a = $x / $y;
  
// Addition
echo "Sum: ", $z; // Sum: 30
  
// Subtraction
echo "Diff: ", $m; // Diff: 10
  
// Multiplication
echo "Mul: ", $p; // Mul: 200
  
// Division
echo "Div: ", $a; // Div: 2
?>

Type the URL xampp/htdocs/gfg/code/1.php in the browser, it will display the result.



Article Tags :