Skip to main content

How to execute PHP Script in Website using XAMPP webserver ?

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-


Open XAMPP control panel, if you want to link database to your code then start MySQL otherwise you will need to start Filezilla and Apache



Xampp starts


Then open Notepad/Notepad++ or any text editor to write PHP program.

<?php 


echo "Geeks for Geeks"; 

?>

Save you file in path xampp/htdocs/gfg/a.php






Then 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  


  

// 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.






Comments

Popular posts from this blog

IOT Projects souce code

IOT  Projects souce code What is IoT? The Internet of Things (IoT) is a network where everyday objects like devices, vehicles, and appliances have sensors and internet connectivity. It lets them gather and share data, work together, and perform tasks without human control. This helps boost automation and efficiency across different areas. You can learn IoT to understand its core components and get further knowledge of its functionalities. 20 IoT Projects with Source Code When it comes to IoT, there are many interesting ideas to explore, from making your home smarter to making an autonomous drone. No matter if you’re just starting or have experience, here are 20 Internet of things projects for beginners and advanced professionals. Simple IoT Project Ideas for Beginners For beginner-level, you can start with simple and fun IoT project ideas that involve basic components like sensors, actuators, and microcontrollers. Below are a few of them: 1. Smart Home Automation Smart home automat...

Connecting R to MySql in English #Training Trains

software design institute training

  ONLINE-OFFLINE IN-PLANT/INTERNSHIP With Certificate Training For B.E(ECE,EEE,CSE,IT,AI,ML,DataScience,Cyper Security),MCA, B.Sc,M.E,M.Tech. @ TrainingTrains.Online Classes Available 100 % Job placement Training Full Stack Developer | Placement Training In-plant Training/Internship Training with Project supports the various Engineering and Non-Engineering, Arts Students to develop their Skills on the IT Companies/Corporate Expectations. DURATION OF IN-PLANT TRAINING: 1 week and Above.DURATION OF INTERNSHIP: 1 Month and Above Internship-inplant training For All Departments students, Internship- inplant Training Python | Java | Full Stack Development | UI & UX | C& C++ | Php | Web Designing - HTML, CSS, Java Script, Bootstrap | MEAN Stack | MERN Stack | MEARNStack | Android | Kotlin | Flutter | Database - Oracle, Mongo DB, MySQL, MS SQL Serer | Visual Studio Code | Objective C | Swift | Go Lang | Frame work - Laravel, Django, Vue JS | Machine Learning | React JS | ...