How2Lab Logo
tech guide & how tos..


Introduction to PHP


What is PHP?

PHP, short for Hypertext Preprocessor, is a very popular programming language for developing websites and web based applications. It is an open source, object-oriented general purpose programming language and was essentially created for the web developers. PHP was originally developed by a Danish developer named Greenlander Rasmus Lerdorf. Subsequently it became an open source programming language.

Some people even interpret the acronym PHP as Personal Home Page. It is referred as a scripting language in the sense that when a browser requests for a PHP page from the server, the PHP codes in the page are interpreted by the server-side PHP interpreter (compiler) on the fly before the web server delivers the page to the requesting browser. This makes developing applications easy as the developer does not need to compile and re-compile the php programs, every time he/she makes changes to the scripts/codes. The PHP files are stored in source code form itself on the web server.

It should be noted that the php codes are always executed on the server and not on the client browser, unlike javascript codes. PHP codes are always executed on the server-side and the client browser only gets the result of program execution and hence the client user can never see the original PHP source code. Javascript codes, on the contrary, are downloaded in source code form to the browser and it is the web browser that runs it, using the client resources.


Capabilities of PHP

PHP is a fully object oriented programming language and is as powerful as languages like Java and C++. Thus, PHP programs can carry out all kinds of backend operations such as file read/write, database read/write, and perform complex computations. Since, PHP allows embedding HTML, Javascript and CSS, it makes it very easy for developers to build user-friendly graphical interfaces for collecting user inputs and for rendering computation results. Though PHP is not limited to rendering only HTML output. It has the capability to output computational results in the form of images and in other media formats such as flash. It even provides facilities to enable generate output in excel, word and PDF formats. It can also generate output in XML format which makes it very easy to communicate with other applications.

Further, since PHP has been specifically created for developing web based applications, certain essential features that are required to maintain state in the stateless web based transactions, can be quite easily implemented using sessions and cookies. Another major advantage of PHP is that it is a platform independent programming language. PHP codes can be developed on a windows platform and deployed on a unix/linux platform without making any changes. PHP servers are available that run along with IIS (on windows) and Apache (on Linux/Unix). PHP servers are also available for other operating systems such as Mac OS, RISC OS and others.

PHP works very well with MySQL database and several other types of databases including MS SQL, Oracle, Informix, and many others through the ODBC connectivity interface. Though, the most widely used combination for PHP is LAMP, short for - Linux Apache MySql PHP. All four of these, viz. Linux, Apache, PHP and MySQL, are open source software. Hence, PHP deployment costs nothing in terms of license cost. In fact the most prevalent and most affordable shared hosting plans available from various hosting providers are essentially setup with Apache web server, PHP server and MySQL database on a Linux operating system.

PHP also has the capability to communicate with applications running on other platforms and other servers through a variety of protocols such as SOAP, JSON, LDAP, IMAP, SNMP, NNTP, POP3, IMAP, SMTP, HTTP, COM, etc. You can also open raw network sockets and interact using any other protocol. PHP also has the capability to invoke Java objects and use them in php programs as PHP objects.

The tremendous capabilities of PHP can be appreciated from the fact that today there are several very complex internet based e-commerce and erp systems running on PHP.


The 3 ways in which you can use PHP

Though PHP was primarily developed to operate as a server side scripting language, its use is not limited to that alone. Here are the three ways in which php can be deployed.

  1. As Server-side script: This is the most widely used deployment for PHP. This deployment requires 3 things. The PHP interpreter/parser, a web server, and a web browser. You need to run the web server, with a connected PHP installation which will parse php pages before delivering outputted pages to the requesting web browser.
  2. Command line script: You can run a PHP script without any need for a web server or a web browser. You only need the PHP interpreter/parser to use it this way. This type of usage is relevant for developing and testing PHP scripts that are invoked by the Cron Task Scheduler.
  3. Desktop application: PHP is not well suited for building desktop applications that have extensive GUI. However, for advanced developers, there is a PHP-GTK module available which can be used for building desktop applications. Cross platform network applications can also be developed using PHP-GTK.

In conclusion, PHP is the language for building web applications.


Share:
Buy Domain & Hosting from a trusted company
Web Services Worldwide | Hostinger
About the Author
Rajeev Kumar
CEO, Computer Solutions
Jamshedpur, India

Rajeev Kumar is the primary author of How2Lab. He is a B.Tech. from IIT Kanpur with several years of experience in IT education and Software development. He has taught a wide spectrum of people including fresh young talents, students of premier engineering colleges & management institutes, and IT professionals.

Rajeev has founded Computer Solutions & Web Services Worldwide. He has hands-on experience of building variety of websites and business applications, that include - SaaS based erp & e-commerce systems, and cloud deployed operations management software for health-care, manufacturing and other industries.


Refer a friendSitemapDisclaimerPrivacy
Copyright © How2Lab.com. All rights reserved.