Funding for 'IT Lab' Project, Phase 1: Progress of sticker sales. Purchase a sticker to help us reach our target.Updated: 2010-02-28 11:53
10.7%
PHP : Hypertext Preprocessor


by Nazly Ahmed


This is the first article of the PHP articles series that I'm planning to write every month. The target audience ranges from a novice to a professional so I will be taking things off from a very basis level. If you already have a fair knowledge in PHP don't get bored with the early stages of the series since the articles will get more interesting when we have the basics up in place. On this article we will look at where it all started and get some background knowledge about PHP.


Introduction

PHP is a Server-side scripting language which can be embedded into HTML. It is widely-used for the development of dynamic web pages and it powers over 21 million domains in the Internet. It generally runs on the Web Server and can be used to collect form data, connect to a database, generate dynamic content, send and receive cookies etc..

PHP generally works on all popular Operating Systems and Web Servers. But its generally popular being in the LAMP stack. LAMP represents Linux, Apache, MySQL and PHP which has become popular in the web industry as a way of deploying web applications.

PHP can also be used for command-line scripting and developing client-side standalone graphical applications which won't be covered in this article series since PHP's principal focus is server-side scripting.


How it works

When a request is made to a PHP script, the Web Server will take the PHP script as input and will result the web page as output.  Any PHP tag will be replaced by the Server before its sent back to the client browser. So in this case the users won't get the PHP code as a result, but only the output of it. The following diagram and the code below will give you a better idea of how it works.

                                                       

If the PHP files contains

 <html>

 <?php echo “Hello World”;

 </html>       

What the end user would get is

 <html>

  Hello World

 </html>

 As you can see in the above code what ever that is placed within <?php and ?> tags will be parsed by the PHP interpreter on the Web Server and will result the output. I won't explain about the code since we will look into the code in detail in the following articles.


History

PHP was first written by Rasmus Lerdorf in 1995. It then stood for  Personal Home Page. He initially created PHP to replace a small set of Perl scripts he was using to maintain his personal homepage. He improved this to PHP/FI (Personal Home Page / Forms Interpreter) that could communicate with databases which enabled building simple dynamic web applications. He released his code for everybody to have a glance at it.

Getting interested in Rasmus's work Zeev Suraski and Andi Gutmans completely rewrote the PHP parser in 1997. It was released as PHP 3, changing the language's name to the recursive acronym PHP: Hypertext Preprocessor. It was officially launched in June 1998. Later they rewrote the PHP core, which produced the Zend Engine in 1999.

PHP 4 powered by the Zend Engine 1.0 was released on May 22, 2000.

PHP 5 was released on July 13, 2004, powered by the new Zend Engine II. PHP 5 included new features such as improved support for object-oriented programming and performance enhancements. The current stable version is PHP 5.2.8.


Who uses PHP?

If you are a newbie to PHP, knowing who uses it will definitely give you a kick start in using it in your developments. Facebook, Wikipedia, Yahoo!, Digg, Wordpress, Drupal and tons of other projects use PHP as their main scripting language.


Licence

PHP is Free Software released under the PHP Licence. Which means you have the fullest freedom to use PHP, study it, modify according to your needs and also you can copy and redistribute it without any restrictions.

Installing PHP

Installing PHP is generally easy.

If you are using Windows you can either download the latest Windows binaries or the PHP Source Code from http://www.php.net/downloads.php and follow the installation instructions. You will also need to have a Web Server in your system. I would recommend you to download and install Apache from http://httpd.apache.org/download.cgi. You can also run PHP with IIS. PHP’s installation instructions will have this topic in more details.

If you are using Linux, I have a written a guide on my blog on how to get LAMP working in Ubuntu. http://www.nazly.net/post/getting-lamp-to-work-in-ubuntu-hardy-270/

 If you are still not happy with the above methods, there are couple of projects that bundle Apache, PHP and MySQL  together and make the installation much easier. XAMPP and WAMP Server are the two projects that I know that does this job pretty well which are available for different Operating Systems.

 I hope you gathered some insight knowledge about PHP and how it works. In the following articles we will go in depth towards coding PHP. Till then have a great time.

 Happy Coding..

 If you have any question please feel free send in them via email. My email address is  me at nazly dot net.


Share/Save
Your rating: None Average: 5 (1 vote)

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options