INTRODUCTION TO PHP

INTRODUCTION TO PHP

?<

Web Architecture

  • PHP Hypertext Preprocessor which was earlier known as personal home page.
  • PHP is basically a server side scripting language which has been designed for the purpose of web development.
  • It is also used as general purpose programming language.

Overview of PHP Platform

In other words, it provides a framework which help a user in saving loads of time, stopping the need to produce large repetitive code, instead it allows to build an application rapidly (RAD).

PHP operates on the Model View Controller (MVC) fundamentals.

No alt text provided for this image


The architecture consist of two components:

Web Browser

The browser generates user request and passes to the server through different protocol and methods. It is also the one who receives the request from the server. It resides on client machine.

Server

Server is responsible for handling the request. Server can be of different type based on operating system. Server consists of apache server, database and file directory. The function of apache is to search and locate the file if found and then send it to the client.

Additionally the server can be of different types based on operating system:

Wamp

Acronym for Windows Apache MySql and PHP. It is server present in Windows Operating system

LAMP

Acronym for Linux Apache MySql and PHP. It is server present in Linux Operating system

MAMP

Acronym for Mac OS Apache MySql and PHP. It is server present in Mac OS Operating system

XAMP

It is cross platform server present in different Operating system.

The working principle of this architecture is described in following steps:

  • First, request is generated in client web browser and passed to the server.
  • Apache server then receives the request and search for the file requested in the database and the directory.
  • If the corresponding file is found, then the requested file is send to client machine for rendering.
  • If not, the server will generate HTTP 404 error in client browser.

Origins of PHP in the open source community

PHP was designed by a developer Rasmus Lerdorf in 1994. It earlier stands for personal home page which now refers to as hypertext pre-processor. The very first version of PHP was a simple set of Common Gateway Interface (CGI) written in C programming language. CGI technology allows user to submit forms in a web browser and interact with programs on the server.

Over a period of time, more functionality was required in PHP to make it much larger and richer application. So, keeping that in mind a new model was designed which was capable of database interaction, providing a framework to users where they could easily develop simple dynamic web applications. Later in June 1995, Rasmus released the source code of PHP tools to the public, which allowed developers not only to use it but he also encouraged them to provide fixes for bugs in the code, and to generally improve upon it.

Why we use PHP?

There are many reasons to use?PHP . Let us discuss some of them below:

  • It is a free license software, which means it will cost you nothing.
  • It is very easy to learn especially beginners can easily adapt to it with some basic knowledge about programming.
  • Its ability to optimize memory, as a result it never allows server overloading etc.

Some of PHP’s strengths

There are many sever side scripting languages which is used for web development. But among all of them PHP is the most popular web scripting language. So, let us find out why PHP is widely used among all.

  • Easy to learn-?It is very easy to learn as it has its root from object oriented programming (OOP). So, developers find it easy to learn and manipulate.
  • Freeware- It is a freeware/open source software, which means developers can freely download and work upon it.
  • Performance-?It support code optimization and minimization which improves its speed and avoid sever overloading.
  • Operating system-?It is platform independent and support many operating systems. PHP works on Windows, Linux, MAC OSX, Unix-like etc. PHP programs are portable between these platforms.
  • Database-?PHP support interaction with almost all databases. Like- MYSQL, Firebird/InterBase, ODBC, Sybase, Mongo etc.
  • Secure-?PHP uses lots of MVC frameworks to work on like laravel, CakePHP, codeigniter which helps in faster and secure web development application.
  • Other tools-?If one needs to access other web based tools like Google maps or any other, PHP has made it easy to access.

It is available with documentation in many languages which makes user understand easily. PHP can be easily embedded directly into a HTML document.

Installing PHP

We have already discussed it in advantages that PHP is portable or platform independent, which means it can run on many platforms, including Windows, Linux, MAC OSX etc. Let us see the steps to install PHP on Windows systems using XAMPP software suite.

Here are steps to install PHP on Windows machine.

  • Open a Web browser and go to?https://www.apachefriends.org/index.html ?The downloads page of the XAMPP platform will open.
  • Click the?Download XAMPP?button for the version and the operating system for which you want to install. As we are showing here it for Windows machine, so we will click on XAMPP for Windows.

No alt text provided for this image

  • Run the XAMPP installer (xampp-win32-7.2.4-0-VC15-installer.exe) and click?Next?to install.

No alt text provided for this image

  • In select components window select the components you want to install; and uncheck the components which you do not want to install. Click?Next?when you are ready to continue.

No alt text provided for this image

  • Select an installation folder where you want to install XAMPP and click on Next and Next again.

No alt text provided for this image

  • Click on Next again and you will an installation window with a progress bar. It will take some time to get install.

No alt text provided for this image

  • Click on Finish to complete installation and click on checkbox which says Do you want to start the Control Panel now??

No alt text provided for this image

  • Once you click on Finish you will see below screen shot.

No alt text provided for this image

  • Check Apache module and click on Start for apache and check on MySQL and click on start for MySQL. Now to launch open your browser and type?https://localhost/dashboard/ . You will get the welcome page saying you have successfully installed XAMPP for your windows.

No alt text provided for this image

Summary

The points below summarize the topics discussed:

  • PHP platform provides user a structure which allows a user to develop web applications.
  • CGI technology allows user to submit forms in a web browser and interact with programs on the server.
  • PHP has ability to optimize memory, as a result it never allows server overloading etc.
  • PHP Hypertext Preprocessor which was earlier known as personal home page.
  • PHP is very easy to learn especially beginners can easily adapt to it with some basic knowledge about programming.


要查看或添加评论,请登录

社区洞察

其他会员也浏览了