PHP – Install/Run
by Ranjith | June 4th, 2009.To run any php file you need to install Apache web server on your localhost. Also you need to install MySQL server for any database programming. You can install these seperatly or there is easy way to achive the same by installing XAMPP.
XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use – just download, extract and start.
You have already learned to write a basic PHP program in the previous page. Here is that program.
<html>
<body>
<?php
echo "MY First PHP Program";
?>
</body>
</html>Write this program in a notepad and save as firstprogram.php
Now to run this do the following steps.
- First download the xampp from http://www.apachefriends.org/en/xampp.html
- Extract the file and double click the exe. This will install Mysql and Apache servers.
- Once the installation is complete, you will find XAMPP under Start / Programs / XAMPP. You can use the XAMPP Control Panel to start/stop all servers. Start Mysql and Apache servers.
- Copy firstprogram.php to C:/Program Files/XAMPP/htdocs/
- To run the php file, you just need to brows http://localhost/firstprogram.php
Note: You can also create any folders inside htdocs folder. For ex. create a folder called “test” and copy firstprogram.php to “test”, then the address will become http://localhost/test/firstprogram.php





