How to execute PHP Script in Website using XAMPP webserver ? Last Updated : 01 Dec, 2020 Comments Improve Suggest changes Like Article Like Report 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- Open XAMPP control panel, if you want to link database to your code then start MySQL otherwise you will need to start Filezilla and ApacheXampp startsThen open Notepad/Notepad++ or any text editor to write PHP program. PHP <?php echo "Geeks for Geeks"; ?> Save you file in path xampp/htdocs/gfg/a.phpThen go to your browser and type localhost/gfg/a.php in URL section. It will display the result.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 <?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. Comment More infoAdvertise with us Next Article How to execute PHP Script in Website using XAMPP webserver ? S sravankumar_171fa07058 Follow Improve Article Tags : Web Technologies PHP PHP Programs PHP-Misc Similar Reads How to read data from a file stored in XAMPP webserver using PHP ? We have given a file stored on XAMPP server and the task is to read the file from server and display the file content on the screen using PHP. We use some PHP functions to solve this problem. File: A file is set of data stored in a disk in different formats. For example - .txt, .exe, .pdf etc fopen 2 min read How to get the current file name using PHP script ? In this article, we will learn how to get the current filename using PHP. Input : c:/xampp/htdocs/project/home.php Output : project/home.php Input : c:/xampp/htdocs/project/abc.txt Output : project/abc.txt Sometimes, we need to get the current file name with the directory name in which our page is s 2 min read How to execute PHP code using command line? PHP is mainly used for creating dynamic websites, but you can also run PHP scripts without a web server. This can be done using the PHP Command Line Interface (PHP CLI), which allows you to execute PHP scripts directly from the command line. This method is commonly used for testing, automation, or r 3 min read How to display XML data in web page using PHP ? In this article, we are going to display data present in an XML file on a web page using PHP through the XAMPP server. PHP is a server-side scripting language that is mainly for processing web data. The XML stands for an extensible markup language. Requirements: XAMPP server Syntax: <root> 2 min read How to open a PDF files in web browser using PHP? Opening a PDF file in a web browser using PHP involves serving the PDF directly to the clientâs browser. This is achieved by setting the appropriate HTTP headers (Content-Type and Content-Disposition) in PHP, which instructs the browser to display the PDF instead of downloading it.Note: PHP doesn't 2 min read Like