Once you’ve downloaded and installed XAMPP onto your computers, its time to write a web application to run on it.
Here is a simple PHP code, that’ll be executed by our XAMPP localhost,
<?php echo ‘This is my first code that’s running on a XAMPP server’; ?>
Copy the code and save to a file, say myfirst.php
[Being a PHP code, it requires a server to execute. If you try and run it like a simple .htm/.html file then it won’t execute correctly. PHP files are only executed on the server.]
Move this file inside the htdocs folder of your installed XAMPP folder. The folder location should be in D://xampp/htdocs.
Execute the code
To run this file, first start the server either directly from desktop or by starting xampp_start.exe inside XAMPP folder.
Once the server starts, open web browser and enter the url localhost/myfirst.php
Your PHP code should get executed.
Note: If myfirst.php is put under a folder named mf in htdocs then the url should be localhost/mf/myfirst.php