What is php?

PHP (short for “PHP: Hypertext Preprocessor”) is a high-level interpreted language embedded in HTML pages and executed on the server.

You have to understand first how the request of pages works in a browser to start programming in PHP.

Communication between client and server without PHP:

1 – Type the address and file to request in the browser bar.

2 – The web browser sends the message through the Internet to the computer, for example www.lanacion.com/pagina1.htm requesting the page (file) page1.htm

3 – The web server (web server, which can be Apache, IIS, etc.), which is a program that runs on the www.lanacion.com machine, receives the message and reads the requested file from the hard disk.

4 – The web server sends the file requested by the browser as it is on the hard disk.

5 – The browser displays the file sent by the web server on the screen.

This process is always the same when we talk about static pages (pages that do not change), whatever the client requesting the page, the content will always be the same. The only way for the content of the file to change is for the administrator of that website to edit the content of the page1.htm file and make modifications.

Communication between client and server with PHP:

1 – Type the address and file to request in the browser bar.
2 – The web browser sends the message through the Internet to the computer called www.lanacion.com requesting the page (file) page1.php

3 – The web server (web server, which can be Apache, IIS, etc.), receives the message and when it sees that the extension is “php” it requests the PHP interpreter (which is another program that runs on the server web) to send you the file.

4 – PHP interpreter reads page1.php file from disk

5 – The PHP interpreter executes the commands contained in the file and eventually communicates with a database manager (examples of these can be MySql, Oracle, Informix, SQL Server, etc.)

6 – After executing the program contained in the file, send it to the web server.

7 – The web server sends the page to the client that had requested it.

8 – The browser shows the file sent by the web server on the screen.

For those who know other programming languages ​​(C – Java – C # – Pascal etc.) the output of the results is normally the screen, in PHP the output is the HTML page (then it travels over the internet and reaches the client who solicitous)

This article was written by admin

Leave a Reply