How to execute PHP files on LOCALHOST using WAMP, MAMP or XAMPP?

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.

How to execute PHP files on LOCALHOST using WAMP? by http://mgwebthemes.com step-2
Step-2

Step-3: right click on it and choose open

How to execute PHP files on LOCALHOST using WAMP? by http://mgwebthemes.com step-3
Step-3

Step-4: icon show on start menu like this.

How to execute PHP files on LOCALHOST using WAMP? by http://mgwebthemes.com step-4
Step-4

Step-5: right click and choose localhost from menu like this

How to execute PHP files on LOCALHOST using WAMP? by http://mgwebthemes.com step-5
Step-5

 

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.

 

How to execute PHP files on LOCALHOST using WAMP? by http://mgwebthemes.com step-6
Step-6

 

Step-7: Create index.php file into mgwebthemes.com directory like this:

 

How to execute PHP files on LOCALHOST using WAMP? by http://mgwebthemes.com step-7
Step-7

 

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:

How to execute PHP files on LOCALHOST using WAMP? by http://mgwebthemes.com step-8
Index.php

Output of index.php

To execute enter your path of development directory. Here my rood directory path on localhost is http://localhost/mgwebthemes.com&#8221; Your file successfully executed on localhost.

How to execute PHP files on LOCALHOST using WAMP? by http://mgwebthemes.com step-9
Output of index.php

Resources & Tools

www.w3schools.com:        This is best site which show you step by step guide for PHP. This site also provide various cources for bigginers. These cources are HTML, CSS, Javascript, JQuery, PHP, AJAX and many more. Please visit on www.w3schools.com.

 

Notepad++                      This is best text editor for developers.

 

 

Advertisements

Author: maheshwaghmare

WordPress Developer since 2012

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s