PHP Introduction

php introduction

Why you’ll learn PHP?

  1. HTML based site is static and lifeless
    Basic HTML pages are simple static pages that only display fixed information with no customization facility. Those are not responsive to user’s action.
  2. PHP brings websites to life
    Using PHP, you can add dynamic behavior, interaction between users and website that you see in websites around. Example of dynamic behaviors could be –

    • User registration and login
    • Website search facility
    • Sending feedback to website owner’s email
    • Displaying data from database to website and storing data into database
    • And, many more
  1. PHP is the most widely used server-side scripting language
    At time of this writing, PHP is the most used server-side language (78.6%) for the websites (Source: http://w3techs.com/technologies/overview/programming_language/all), ASP.NET is in the second position with only 20.3%. The statistics also shows that PHP is the sixth popular of all the programming language. (Source:
  2. Easier to learn and Implement
    PHP is easier to learn than its competitors such as like ASP, CGI, and others. It is so easy, that a beginner can learn php write a program within few days.
  3. Free and Platform Independent
    PHP is open source, that means PHP is free. You don’t have to worry to purchase license to use it. Also, another great advantage is that same PHP code can be run on different platforms (Windows, Linux, MAC OS X) and you’ll get same output.
  4. Nearly Every Database supports available
    One of the greatest features in PHP is its support for a wide range of databases, nearly every databases – MySQL, ORACLE, PostgreSQL, Sybase, Informix to name a few.

What is PHP?

  1. PHP is a server-side scripting language that means its code is executed on the server.
  2. PHP was created by Rasmus Lerdorf in 1995.
  3. Though PHP was originally known as Personal Home Page (PHP Tools), but, with the increase of its usefulness and capabilities, the meaning changed to PHP:Hypertext Preprocessor.

What is the prerequisite to learn PHP?

  1. If you want to use PHP to create web sites and want to write code for client-side (Click here to know more about Client-side language), then you need to know HTML before learning PHP.
  2. To write better PHP code, you need to have knowledge in programming – data structure, algorithm.

How PHP pages work over internet?

As PHP is a server-side language, it is executed on the server and the output is sent to the browser that visitors see. When a visitor browses a php-based website, here are the steps that happen:

How PHP Works
  1. Visitor’s web browser sends a request to the web server where the site is hosted
  2. If the requested web page has PHP extension (for ex. filename.php), the web server forward it to the PHP interpreter that is installed on the web server.
  3. PHP interpreter gets the PHP file from the hard drive, executes the PHP code. It sends or receives information from database if the PHP script is written to do so. Then it generates output as HTML code and sends it to web server.

    AS PHP interpreter handles data before it becomes HTML, therefore, it is called PHP:Hypertext Preprocessor.
  4. At last, the web server sends the HTML output to the requested browser.

Which softwares do you need to run PHP?

  1. Most web hosts offer PHP support. So, you don’t need to install any software to run php file. All you need to do is put the php files in the web directory (In the installation lesson you’ll see where web directory is located.).
  2. In case php is not installed in your host, or you want to run php file in your local PC, you’ll need
    • Apache (or IIS) as Web server
    • PHP itself, and
    • MySQL as database (To store information, database such as MySQL is required.

    [Apache, PHP, and MySQL installation will be discussed in the installation chapter.]

Which softwares do you need to write PHP?

You need programming editor or IDE to write PHP. They are designed to speed up development time. There are many free and paid editors available. Choose an editor according to your requirements. Some of the editors and IDEs are mentioned below-

  1. Free softwares: Among many other, Notepad++ (download link http://notepad-plus-plus.org/) is one great programming editor and NetBeans is one great IDE for Windows system. Beginners can start with this Notepad++. For MAC users, there are TextEdit, TextWrangler etc. Editra is a choice for many web developer and it runs on Windows, MAC OS X, and LINUX, it’s free (http://editra.org ).
  2. Paid softwares: There are many great paid editors/IDEs for both Windows and MAC OS X. For example, Dreamweaver is a great IDE for Windows, and TextMate is a great editor for MAC (preferred text editor of choice on MAC for many web developers).

What is the difference between editor and IDE?

  1. Programming editors: Programming editors have features that help to write program faster. Some features include-
    • Highlighting syntax
    • Showing line numbers
    • Opening multiple files at a time
    • Providing code library
  2. Integrated Development Environment (IDE): IDE has support of all the features of programming editor as well as has other options that make an entire development environment. Some extra features that IDE provides include-
    • Testing
    • Debugging
    • Webpage Previewing
    • Providing FTP support to upload or download file.
‹‹ Course Overview : Previous Lesson Next Lesson : PHP Installation >>