DEV Community

Cover image for PHP | Introduction
Akamshu
Akamshu

Posted on • Edited on

PHP | Introduction

INTRODUCTION TO PHP

The term PHP is an acronym for PHP: Hypertext Preprocessor. PHP is a server-side scripting language designed specifically for web development.

Websites like www.facebook.com, www.yahoo.com are also built on PHP.
One of the main reason behind this is that PHP can be easily embedded in HTML files and HTML codes can also be written in a PHP file.
The thing that differentiates PHP with client-side language like HTML is, PHP codes are executed on server whereas HTML codes are directly rendered on the browser. PHP codes are first executed on the server and then the result is returned to the browser.
The only information that the client or browser knows is the result returned after executing the PHP script on the server and not the actual PHP codes present in the PHP file. Also, PHP files can support other client-side scripting languages like CSS and JavaScript.

Website architecture

Website architecture is the planning and design of the technical, functional and visual components of a website - before it is designed, developed and deployed. It is used by website designers and developers as a means to design and develop a website.

Website architecture is used in creating a logical layout of a website in line with the user and/or business requirements. It defines the different components that will make up a website and the services each component or the website will provide in whole.
Some of the factors that are part of website architecture are:

  1. Technical constraints such as server, storage. memory and communication interfaces.

  2. Functional aspects such as the type of services or processes the website will provide.

  3. Visual appearance, i.e. the user interface, colors, buttons and other visual design elements.
    Security parameters i.e. how the website will ensure secure access control and transactions.

Why should we use PHP?

PHP can actually do anything related to server-side scripting or more popularly known as the backend of a website. For example, PHP can receive data from forms, generate dynamic page content, can work with databases, create sessions, send and receive cookies, send emails etc. There are also many hash functions available in PHP to encrypt user’s data that makes PHP secure and reliable to be used as a server-side scripting language. So these are some of the abilities of PHP that makes it suitable to be used as server-side scripting language. You will get to know more of these abilities in further tutorials.

Even if you are not convinced by the above abilities of PHP, there are some more features of PHP. PHP can run on all major operating systems like Windows, Linux, Unix, Mac OS X etc. Almost all of the major servers available today like Apache supports PHP. PHP allows using wide range of databases. And the most important factor is that it is free to use and download and anyone can download PHP from its official source : www.php.net.

Origin of PHP in the open Source Community

PHP was developed by Rasmus Lerdorf. It was first developed in 1994 as Personal Home Page. It was released in 1995 as Personal Home Page Tools. This was a parser which interpreted files written in the simplified programming language of PHP. The programming language of PHP was developed long after other scripting language had been in use so Lerdorf was able to incorporate the lessons of programmers experience with those other languages.

The experience with the initial offering of PHP was positive enough to prompt Lerdorf to create an improved version of the parser, called PHP/FI (form interpreter). This version could interpret HTML code as well as the PHP programming code. PHP/FI also made some provision for database capabilities by supporting some elements of mSQL.

By mid-1997 there were about fifty thousand websites created using PHP. At that time the programming for PHP was recreated with a team of programmers helping Lerdorf in this effort. This revised version was called PHP 3. PHP 3 provided support for MySQL, the database query language, among a collection of other database systems.

The next version, PHP 4, increased the features of PHP but the subsequent version PHP 5 was more devoted to increasing the efficiency of the system than expanding its features. Now PHP can be included within an HTML file.

Some of the strengths of PHP

Supports database connectivity: PHP can access over 20 different databases including MySql, Oracle, and MS Access.

Supports sessions: PHP can generate unique session IDs. The ID follows the user during a single session on a web site. This simplifies creating shopping cart applications and tracking user's behaviors.

Eliminates client configuration problems: With PHP there is no need to worry if the client has the appropriate software installed, since the application is executed on the server.

Reduces development time: Even a newcomer can begin developing PHP applications in hours. Yet PHP contains many advanced features for professional programmers.

Maintains source code security: The user does not see your source code as they do with JavaScript.

Availability across multiple platforms

A user can use PHP with Windows, Linux, or Macs.

Installing as a module for Apache Web Server

There are some excellent all-in-one Windows distributions that contain Apache, PHP, MySQL and other applications in a single installation file, e.g. XAMPP (including a Mac version) and WAMP Server but manually installing Apache and PHP helps to learn more about the system and its configuration options.

Top comments (0)