Showing posts with label how to run php program. Show all posts
Showing posts with label how to run php program. Show all posts

Wednesday, May 22, 2024

how to run php program

 How To Run A PHP Code In  XAMPP

how to run php program


How to Install XAMPP ?


 1]   Apachefriends developed XAMPP . 

2] XAMPP available for everyone free of cose,

 3] download XAMPP through the official website

     https://www.apachefriends.org/download.html

  completing the download of the  setup file, than installation process  "select components"             section , select all the required components.

 setup




  ∴ Next, Select the directory where you want the software to be installed.it is recommended that you 
      use default directory "c\xampp" and click on "next " to complete the installation.


How to Start a New PHP Program In XAMPP ?

1]  Before you run or start  writing any program in php ,you start Apache & MYSQL.

2] next starting both servers, you have to write a program in Notepad, visual studio code ...... etc.

3]  next writing it, save that file  Name  as "program.php".

4] Before copy that file program.php to c:/program Files/ XAMPP/htdocs.

5]  open the browser and type http://localhost.

6]  Now run your code in that browser. 

 How to Run  a PHP Code using XAMPP?

 1] Before running a php script, you must know anywhere to write it.  

2]  XAMPP directory, there exists a folder called "htdocs" This is Where all the programs for 
     The web pages will be stored.

3]   Now, run a PHP Script.

1]  Go to "C:\xampp\htdocs" and inside it, create a  folder. lets  call it  "demo" it's considered 
     good practice to create  a new folder for every project you work on. 


2] Inside the demo folder, create a new text file and name it "index.php" and write the following script.

  
<?php
echo " hi";
?>
<?+php
echo "<marquee>learn php language </marquee>" ;
?>


3] Now to see the script  output open the XAMPP  control panel  and start Apache to host the local 
   webserver, where our script will be running.




4] Now navigate to your browser and type in "localhost/demo/" in the address bar to view the 

∴  OUTPUT  :


 Congratulations with this  you have  created a PHP  file and also executed the          program Successfully.


1) Can we run PHP in XAMPP? 

Yes, you can run PHP  in xampp. First start the XAMPP Server create a program                             you want to and  run  http://localhost.


2) How do I run my PHP file?

PHP  files are saved in c:/program  files/XAMPP/htdocs.
you have to open it. click on the program, and it will automatically run on localhost.