In this tutorial I will show you how to Execute PHP files using WAMP.
Note: Execution procedure of PHP files on WAMP, MAMP and XAMPP are similler.
In this article shows you how to run php file on local computer.
Before going to practical tutorial just read little bit about which techniques are used for it.
First you wants’ some software’s these are libraries such as APACHE SERVER, PHP Library, MYSQL database (for database connectivity) for executing php files. Don’t confuse about what is APACHE SERVER, PHP library & MYSQL.
PHP : This is php function library which is available on www.php.net. It is group of predefined functions & classes which helps you for creating php files.
MYSQL: It is a database like Oracle 11g, Microsoft Access. PHP is flexible scripting language which is better to interacting with MYSQL.
APACHE: It is server which provide platform for executing php files.
COOL, Now today are various software’s available which combine all of these techniques (PHP, MYSQL, APACHE) into single one.
These are follows:
LAMP: stands for Linux Apache Mysql PHP used on Linux operating system.
MAMP: stands for Mac Apache Mysql PHP used on Mac operating system.
WAMP: stands for Windows Apache Mysql PHP used on Windows operating system.
XAAMP: I recommend this. Because it is used on all of operating systems i.e. Linux, Windows, Mac etc.
All of those provide same functionality. These also include PHPMYSQL (It provide visual interface for creating and managing MYSQL database.) and other features.
Ok, I work on WAMP so I show you how to run php file using WAMP.
Step-1: Download & install WAMP from www.wamp.net
Step-2: After installation it shown like this on desktop or start menu.
Step-3: right click on it and choose open
Step-4: icon show on start menu like this.
Step-5: right click and choose localhost from menu like this
Step-6: Wamp provide folder www located in location “c:wampwww”. Here you create your site folder and store you php files i.e. create folder mgwebthemes.com into www directory.
Step-7: Create index.php file into mgwebthemes.com directory like this:
Note: This is index.php file here, <?php & ?> are tags, Inside these tags we create php code. echo is used for printing text this is same as printf function of C language.
Ok. Save this file and open on browser. It show you output of our index.php on browser like this:
Output of index.php
To execute enter your path of development directory. Here my rood directory path on localhost is “http://localhost/mgwebthemes.com” Your file successfully executed on localhost.
Resources & Tools
Notepad++ This is best text editor for developers.