× Please, log in to give us a feedback. Click here to login

You must be logged to download. Click here to login


MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation


MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

PHP: Introduction

PHP stands for PHP Hypertext Preprocessor. PHP program is the server based programming language. In this article we will learn how to write scripts in PHP and run it in web browser.

In our programming world there are many types of scripting languages as well as server site scripting/programming languages present, like JavaScript, VbScript, Active Server Pages, .net technology, Java Server pages and also PHP Hypertext Preprocessor [PHP]. This all types of languages are used to develop different types of server programming.

When we write down PHP program then we easily find out that many codes are written in the logic of C language. However the general syntax of PHP code is that given below.

The following sample is showing PHP syntax.


When we write down the PHP code then this php file should save with .php extension. After writing the code this php file runs with the following procedure. In this scenario we get a web server and a client server present. After the execution, the program server gives the response to the respective client. Client gets the result from the server side process. For developing this scenario HTTP Request has also got a standard role. So it is remembered that without server no PHP script is generated.

Diagram showing PHP processing

Figure 1: Diagram showing PHP processing

There are different types of servers available in our software world like wamp server, xamp server etc.

So, when we need to write and run a PHP program then we have to install a server that server is responsible for running all php code.

Now we will discuss about Installation procedure of WAMP server.

Double click on Wamp Sever exe file -> A Wizard will appear. Click Next.

Showing Wamp Sever

Figure 2: Showing Wamp Sever

The License Agreement screen will appear -> accepts the License agreement and click Next.

Showing Wamp Sever license agreement

Figure 3: Showing Wamp Sever license agreement

At the Select Destination Location you can change the install directory. The default is C:\wamp. -> We use the default directory in the system. -> Click Next.

Showing installation directory location

Figure 4: Showing installation directory location

Select the Start Menu Folder. We use the default Wamp Server folder in the tutorial. -> Click Next.

Showing default directory location

Figure 5: Showing default directory location

You can set WAMP to automatically start each time -> Windows start. I would praise that you do not check this option. This could cause security issues on your home computer if you were to leave the server running whenever the computer is turned on. You should manually start your WAMP/Apache server when you need it. Click Next.

Showing automatic start setup

Figure 6: Showing automatic start setup

At the Ready to install screen, click next.

Showing installation

Figure 7: Showing installation

The Installing screen will appear indicating the installation process.

Showing installation progress

Figure 8: Showing installation progress

You will need to select the default publishing folder or DocumentRoot folder. This is the folder that you store your web site in. Any files that are placed in this folder will be available on the Internet by typing in the IP address of the machine. You will use this folder as the Testing Server Folder when you are working in Dreamweaver. The path to the folder is C:\wamp\www. Click OK. On a web host you usually store your files in a folder called www or public_html; this procedure is setting up that storage folder.

 Showing installation folder

Figure 9: Showing installation folder

At this screen you will select your default web browser. In the tutorial we have left Internet Explorer as the default browser. No changes were made to this screen. If you prefer to use another browser like Firefox or Opera you will have to navigate to the executable *.exe file of the browser. Click Open.

Showing browser selection

Figure 10: Showing browser selection

If necessary, check Launch WAMP5 now and click finish completing the Installation.

Showing installation complete

Figure 11: Showing installation complete

Then you will be asked to give an alias to the site, this is what you type after http://localhost/ in the browser. Previous one was "srimani_php" which is actually the folder name itself. But this is not necessary in this case. You can put anything. But don't use spaces or dots.

Showing console entries

Figure 12: Showing console entries

Let's put "srimani_php"

Showing console commands

Figure 13: Showing console commands

Then you will be asked what is the actual folder that srimani_php alias point to.

Give the following, F:\srimani_php

Showing console commands to the alias

Figure 14: Showing console commands to the alias

Now press enter to close the DOS prompt and go to your browser and type the http://localhost/srimani_php/

You will see the root index now. Put the notepad file we created earlier to "F:/srimani_php"and refresh the browser page to test the PHP.

After the creation of the alias directory then we store our program inside the folder for the accessing data from the server.

Now the step by step procedure to running the php program

Open alias directory write the following program

	echo "<h1><center>Welcome to Computer Educational Institution... </center></h1>";

Open website using the URL: http://localhost/srimani_php/

Showing php page

Figure 15: Showing php page

Select following link and show the output.

Showing link

Figure 16: Showing link

The output of the following program is:

Showing output

Figure 17: Showing output

Through this process we can easily execute our PHP program and show the output.

Now I discuss some sample example for writing and running PHP code.

Listing 2: Sample showing Example using PHP as well as HTML Program calculator.html

<body bgcolor="lightyellow">
<h2><marquee behaviour="alternate" direction="right">Welcome To Simple Calculator by S.Srimani</marquee></h2>
<form method="post" action="cal.php">
<table border="4" align="center">
<tr><td><h3>Enter the First No::</h3></td><td><input type="textbox" name="n1"></td></tr>
<tr><td><h3>Enter the Second No::</h3></td><td><input type="textbox" name="n2"></td></tr>
<table border="4" align="center">
<tr><td><input type="submit" name="add" value="ADD"></td>
<td><input type="submit" name="sub" value="SUB"></td>
<td><input type="submit" name="mul" value="MUL"></td>
<td><input type="submit" name="div" value="DIV"></td>

Listing 3: cal.php

<body bgcolor="lightyellow">
	echo "Addition Is::".$c;

else if($_POST["sub"])
	echo "Subtraction  Is::".$c;
else if($_POST["mul"])
	echo "Multiplication Is::".$c;
else if($_POST["div"])
	echo "Division Is::".$c;

In this program at first we have to design calculator.html this calculator program we take label and text box after that we take different button like ADD, SUB, MUL and DIV.

After that we create cal.php this cal.php program is generally accept data from calculator.html file. When we send data then we have to use get or post methods get method is not highly secure but post method is highly secure get method send data through progress bar.

<form method="post" action="cal.php">

In this code method tag is use to post and action="cal.php" this is use to call cal.php code.

Editor of PHP

PHP is Cross-platform language so there are different kind editor is present to writing and running php program. Some php editor is given bellow

Cross-platform editor for PHP program write

Editor Name Purpose
ActiveState Komodo Edit This is use to PHP syntax checking
Bluefish This is multipurpose editor with PHP syntax support
Eclipse The is use to PHP Development Tools
Emacs This is advanced text editor. Then nXhtml addon has special support for PHP
Geany This Editor Syntax highlighting for HTML + PHP. Provides PHP function list.
Vim This editor provides PHP syntax highlighting.

Windows editor for PHP program write

Editor Name Purpose
Alleycode HTML Editor This is Freeware editor with syntax highlighting. It is also provide php and html
CodeLobster Free PHP IDE
Crimson Editor Lightweight editor. Supports FTP
Dev-PHP IDE Lightweight IDE. Supports FTP & SFTP, CVS & SVN, Multiple languages with highlighters, Xdebug, etc
Gizmo Editor Freeware editor with syntax highlighting for php, html, css, java, and much more.
PHPEdit Free for student use, shareware, counts down from 30 days after install. Programmer's Notepad
RadPHP (formerly Delphi for PHP) This is a commercial product, free for a 30 day trial
HapEdit A free PHP Editor with intellisense support

Linux editor for PHP program write

Editor Name Purpose
gedit This editor support PHP coding
gPHPEdit This editor support PHP coding in a Linux base system.
Kwrite This Linux base PHP editor.
KDevelop This editor is use to write PHP code.

MAC OS X editor for PHP program write

Editor Name Purpose
Espresso This is an editor to support FTP, SFTP and Amazon S3 but it is trial version is available.
Coda This editor is supported to FTP, SFTP, SVN system. Trial version is available here.
Smultron This is MAC OS X base PHP editor.
TextWrangler This is an editor for supporting SFTP and FTP.
Aquamacs Emacs The edit is made for Mac OS X.

Commercial editors editor for PHP program write

Editor Name Purpose
ActiveState Komodo IDE It is an editor to Sustenance for PHP syntax checking and debugging procedure. A trial version is available here.
JetBrains PhpStorm It is a professional PHP IDE with progressive editor, on-the-fly code analysis and other web development specific tools including FTP/SFTP synchronization. But a trial version is available here.
Microsoft Expression Web This editor supported full PHP with syntax highlighting. This is license version. So we can get only trial.
PHPEdit This editor is very popular to supports SFTP and FTP
phpDesigner Generally we are now using this editor because it is supports SFTP and FTP, syntax highlighting for many programming languages.
NuSphere PhpED It is an editor that support for FTPS (TLS/SSL) and WebDAV/HTTPS (SSL) protocols, syntax highlighting for (PHP, XML, XHTML, HTML, CSS and JavaScript) languages. It is license version.
Cayoren PHP Studio Only the trial version is available.
Rapid PHP Trial version is present. Full license version has to purchase.
HyperEdit This is Integrates parts support to PHP, javascript and html in an only interface WYSIWYG[What you see is What you get]
VS.Php for Visual Studio Another important PHP IDE for Visual Studio 2005, 2008 and 2010. Full intelligence and debugging support for native PHP applications and so far.
WeBuilder This editor is generally use for Syntax highlighting for ASP, CSS, HTML, JavaScript, PHP and Ruby.


PHP is cross-platform supported language. The concept of PHP programming is coming from C-Language so many programmers easily communicate with it and also we can easily write and run PHP code in different editor and simply tests this program through different server. For that reason I can easily say that PHP writing and running is very much user friendly.

Hope you liked the article, see you next time.

Website: www.techalpine.com Have 16 years of experience as a technical architect and software consultant in enterprise application and product development. Have interest in new technology and innovation area along with technical...

What did you think of this post?
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!

> More info about MrBool Credits
You must be logged to download.

Click here to login