PHP - Basics - Part 1 - Introduction to PHP, mySQL and Apache Server
Temmuz 12, 2011 by PHP Tutorial
|
|
Article Information
This PHP Tutorial contains and tries to cover following subjects:
- An introduction to PHP, MySQL and Apache Server
Articles tries to provide answer to following questions and issues:
- What is PHP
- What are necessary to know for starting to develop web applications with PHP?
Articles pre-requisites following information:
- General knowledge of Scripting
- General knowledge of HTML
- General knowledge of CSS
- General knowledge of RDMS and SQL
Introduction to PHP
In this PHP Tutorial, we will try to cover What is PHP, how to start programming with PHP and where to start with basics.
PHP is a programming language, scripting that is being used in development area. In a basic HTML web page, the content contains tags and elements, a static entity when browser load it, interprets the tags and presents the the page. Why we need to use PHP in a HTML page. Well.. in order to understand why to use PHP, first we need to understand how a web site works. A web site means pages that is visited by a visitor. In a remote environment, in a web server, the hosted pages are send to the browser when a visitor visits. Lets look into how a web page works.
1. A user enters a domain name into the browser: for example into IE, Mozilla or Chrome (technically we call browsers client.
2. Web browser takes the domain name, and connects to a DNS Server. Basically, a DNS server is a big database that keeps record of IP addressee of domains. Some sort of global name service.
3. DNS server tells back to requester browser (client or visitor computer) the IP addressee of queried domain.
4. Browser takes IP addressee. Now our browser knows where server is located. It sends request of entry page of web site to the IP addressee (Web Server) that DNS server told.
5. Web Server takes request, and sends the entry page of web site to the browser
6. Browser takes HTML entry page for example default.html, and renders it with inspecting its tags and elements.
Above steps are description of a basic HTML site presentation. However, HTML is static which means it is once interpreted by browser and is shown to visitor in his or her browser. In order to bring interactivity to that web page, javascript and other scripting languages steps in. A javascript in HTML can interactively behave to the user. Lets assume that we have a register form in our web page. Javascript can listen user name input, and once user try enter a user name that is already exist in database, javascript can show a message below user name text box. CSS and Ajax technologies steps in further to extend interactivity.
If we go back to HTML web page steps, HTML page once it is rendered. It stays statically in browser.
Javascript is a scripting language, then what is difference between Javascript and PHP. Main difference lays in sides. Javascript is interpreted in client side. Technically, javascript is a client-side scripting language. PHP is server-side scripting language. What is difference between server-side and client-side scripting. To understand this, we need to go back to our web site process above.
Web server listens web requests. When a browser from a client browser arrives (hosting or a remote computer server) finds requested HTML page in its hard drive, and sends it directly to the requester web browser client without executing any programming on HTML.
However, if web page is PHP, PHP page contains programming inside. For example it can contain a line like:
Welcome visitor. Today is date()
date() above is a function for PHP. When browser of client asks default.HTML, default.php which contains above code first interprets code and sends browser an HTML page like
Welcome visitor. Today is October 9, 2012.
Idea behind PHP is to tell web server do some stuff and build HTML page, and then send it to client as HTML. Some sort of modifying HTML before send.
PHP works similar to ASP.NET language. ASP.NET web page resides in a hosting remote environment, in a web server, as a DLL. When a browser asks a page. Web server asks to ASP.NET page to produce HTML. ASP.NET produces a HTML page with programming content inside it. Finally, it gives a HTML page to web server. Web server sends HTML to the browser in both case.
In next part, we will take CSS, mySQL and Apache web server to our scenario and explain where does steps in in a web request.
Data Layers
Area: | programming \ languages \ php \ \ \ |
Ref: | |
Loc: | articles |
Tags: | php |
|