PHP Introduction And Enviornment Setup

Note: You must have the knowledge of HTML, CSS, and JavaScript.

To learn PHP we should read this boring theory but next tutorials are very interesting .

PHP (Preprocessor Hypertext) is a server side scripting language. It is free to use and open source. Pages code is written in PHP, compiled and executed on the server side but pages are visible to client as an HTML page, but the client is not able to see the source code of the page. With the help of PHP we can make the web page dynamic. Dynamic means page, according to user like the Facebook when we open Facebook and enter the username and password then we see only the information of us, this is a dynamic web page.

server

web server

To understand this we take an example of the Facebook. The client has the web browser and he request for the web page of Facebook by entering the URL facebook.com. Then Facebook provide login page, when user enters his/her username and password then the server checks the username and password is correct or not which is saved in database of the Facebook. If it is correct then the page of client is opened otherwise it generates an error. When the user open his/her Facebook ID, then he/she can see the timeline, photos, etc. He/She can update status, upload anything, etc.

So this is the working of Facebook but what are the things that the PHP Application did in this:

  1. Firstly, PHP Application provides the login page in an HTML web page.
  2. Checks for username and password with the help of the database of Facebook.
  3. If the password and username is correct, then PHP Application open the users page, otherwise generates error.
  4. All uploads of all the user saved in the database of Facebook, but PHP only provide the data which user want.

There are many tasks that a PHP Application did:

  1. About PHP File

    A PHP file can contain the text, HTML, JavaScript, CSS and PHP code. How, we see in the next tutorials. The PHP file saves on server and runs on the server. The extension of the PHP file is .php.

  2. Powers of PHP

    PHP can generate dynamic page content. PHP can create, open, read, write, delete, and close files on the server. It can collect form data. PHP can send and receive cookies and it can add, delete, and modify data in your database. PHP can be used to control user-access & authentication. It can encrypt data.

  3. Reasons of using PHP

    PHP runs on various platforms (Windows, Linux, UNIX, Mac OS X, etc.). PHP is compatible with almost all servers used today (Apache, IIS, etc.). PHP supports a wide range of databases and is free. Download it from the official PHP resource: www.php.net. It is easy to learn and runs efficiently on the server side.

Environment Setup for PHP

To use PHP, we need a web host with PHP support. Now you just create some .php file and save this on your web directory, the web host server will automatically parse them and then a user can access this web page, there is no need to compile using extra tools for making it run. PHP is free and most of the web hosts supports the PHP.

So we can use your system as a web server, to do this we need some software:

  1. Install a web server
  2. Install PHP
  3. Install a database, such as MySQL

This is very boring to install all software partially and use it partially, instead, we can use xampp. There is only one software that need to install in the system that provide a GUI control panel.

To install xampp here are the steps:

  1. Open the URL.
    .
    install xampp

  2. Click download (Available for Linux and MAC os & 32 bit and 64 bit ).

  3. After downloading, open the installation package.

    installation package

  4. Follow the steps (you know how to install software).

The next thing we want an editing software like notepad. Here, I will suggest to use notepad++. To install it the steps are:

  1. Open the URL.

    notepad

  2. Click on the link which is in marked red here. Notepad ++ is downloaded in your computer.

  3. Then install it, you know well how to install software no extra things are to be done.

We use notepad++ to write our code. And it is a very user friendly editor.

The theory is not fully discussed but enough to start I will tell you about the theory when it needed in programming.

So these are the boring stuff of all programming languages.

Now we start with some coding.

Reference


Similar Articles