Your SlideShare is downloading. ×
0
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
PHP Training: Module 1
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

PHP Training: Module 1

4,841

Published on

HTML/XHTML and HTTP Basics Review …

HTML/XHTML and HTTP Basics Review
PHP and the Web Server Architecture Model
Overview of PHP Capabilities
CGI vs. Shared Object Model

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total Views
4,841
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
383
Comments
1
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. PHP – Module 1 Hussain Fakhruddin [email_address]
  • 2. Agenda <ul><li>HTML/XHTML and HTTP Basics Review </li></ul><ul><li>PHP and the Web Server Architecture Model </li></ul><ul><li>Overview of PHP Capabilities </li></ul><ul><li>CGI vs. Shared Object Model </li></ul>
  • 3. HTML/XHTML and HTTP Basics Review <ul><li>HTML/XHTML – a language that every browser knows. </li></ul><ul><li>HTTP – a protocol that every machine uses to talk with others. </li></ul>
  • 4. HTML – Hyper Text Markup Language <ul><li>Basically designed and used as a common language to retrieve documents from web. </li></ul><ul><li>More features (called as tags) added later. </li></ul><ul><li>Now is replaced by dynamic languages (like PHP) in some places. </li></ul><ul><li>Tags are basically used to organize contents of document. </li></ul>
  • 5. XHTML – eXtended HTML <ul><li>A strict format of HTML </li></ul><ul><li>Each starting tag must have ending tag. </li></ul><ul><li>There are strict rules to be followed. </li></ul><ul><li>e.g. In HTML &lt;br&gt; is allowed, but in XHTML it must be &lt;BR/&gt; Similarly: HTML XHTML &lt;p&gt; &lt;P/&gt; &lt;li&gt;... &lt;LI&gt;......&lt;/LI&gt; </li></ul>
  • 6. Web Server Architecture Model <ul><li>Client server model. </li></ul><ul><li>Like a query session after a lecture! </li></ul><ul><li>Clients send request, server sends reply to the requested. </li></ul><ul><li>Our web browser is typical client, which formats HTTP (or HTTPS etc.) request and sends to a server. </li></ul><ul><li>A server (e.g. Apache on www.sachinism.com ) formats response and sends back to the browser. </li></ul>
  • 7. Working of Internet
  • 8. A representation of client-server talk - 1 Client Server To Server, “Can you please give me index.htm?”
  • 9. A representation of client-server talk - 2 Client Server To Client, “ Sure, here it is...” Contents of index.htm
  • 10. A representation of client-server talk - 3 Client Server Wow... I am lucky to get index.htm so fast! Actual webpage, that can be displayed on browser
  • 11. HTTP – HyperText Transfer Protocol <ul><li>Protocol for talks between Client and server for Websites. </li></ul><ul><li>Default Port no. 80 </li></ul><ul><li>Simple, text based protocol </li></ul><ul><li>Request – Reply model </li></ul><ul><li>Stateless </li></ul><ul><li>Two most frequently used methods (operations) – GET and POST </li></ul>
  • 12. HTTP Format <ul><li>Request Format </li></ul><ul><ul><li>Request line (e.g. GET /images/logo.gif HTTP/1.1) </li></ul></ul><ul><ul><li>Headers (e.g. Accept-Language: en) </li></ul></ul><ul><ul><li>An optional message body </li></ul></ul>
  • 13. HTTP Request in details <ul><li>Request method – e.g. GET / POST / PUT </li></ul><ul><li>URL – where to send the request </li></ul><ul><li>HTTP version – e.g. 1.1 </li></ul><ul><li>POST /my_dir/my_sub_dir/my_file.htm HTTP/1.1 </li></ul>
  • 14. Request methods -1 <ul><li>HEAD Request only headers for an GET request, not actual resource / data. Used to retrieve meta-data. </li></ul><ul><li>GET Request actual resource. Used as a method to send data along with request. This data is shown on address bar of a browser! </li></ul><ul><li>POST Request actual resource. Most common method used to send data to be processed by the resource. This data is not shown in address bar, is inserted in request body. </li></ul>
  • 15. Request methods -2 <ul><li>PUT Uploads a resource. </li></ul><ul><li>DELETE Removes / Delets a specified resource. </li></ul><ul><li>TRACE Redisplays a request, to check if some server in midway to the destination has changed any value. </li></ul><ul><li>OPTIONS Returns methods supported by the server&apos;s specific resource. Used to check server&apos;s functionality / support. </li></ul><ul><li>CONNECT Converts the request connection to a transparent TCP/IP tunnel. Not much secure. </li></ul>
  • 16. HTTP Format <ul><li>Response form </li></ul><ul><ul><li>Status line </li></ul></ul><ul><ul><li>Headers </li></ul></ul><ul><ul><li>An optional message body </li></ul></ul>
  • 17. HTTP Response Status Line <ul><li>HTTP Version </li></ul><ul><li>Status code of 3 digits </li></ul><ul><li>Status description </li></ul>
  • 18. HTTP Response – Status details <ul><li>200 OK Request successful </li></ul><ul><li>302 Moved Permanently URL is no longer used by server </li></ul><ul><li>404 Page not found Requested document / resource not found </li></ul><ul><li>500 Internal server error Some error on server </li></ul>
  • 19. Request / Response Headers <ul><li>Exchange of information between client and server. </li></ul><ul><li>Each line : Header name + value </li></ul><ul><li>Classification of header lines: </li></ul><ul><ul><li>General header </li></ul></ul><ul><ul><li>Request header </li></ul></ul><ul><ul><li>Response header </li></ul></ul><ul><ul><li>Entity header </li></ul></ul>
  • 20. General Header <ul><li>Can be present in both – request and response. </li></ul><ul><li>Header Description </li></ul><ul><ul><li>Cache-control Information about caching </li></ul></ul><ul><ul><li>Connection Connection should be either closed or kept open. </li></ul></ul><ul><ul><li>Date Current date </li></ul></ul>
  • 21. Request Header <ul><li>Specific to request messages. </li></ul><ul><li>Header Description </li></ul><ul><ul><li>Accept Message format that is supported by client </li></ul></ul><ul><ul><li>Accept-language Language that client accept </li></ul></ul><ul><ul><li>Host Host and port number of client </li></ul></ul><ul><ul><li>If-modified-since Send the document if newer than specified date </li></ul></ul><ul><ul><li>If-unmodified-since Send the document if older than specified date </li></ul></ul>
  • 22. Response Header <ul><li>Specific to response message </li></ul><ul><li>Header Description </li></ul><ul><ul><li>Age Age of document </li></ul></ul><ul><ul><li>Retry-after Date after which server is available </li></ul></ul><ul><ul><li>Sever Sever name + port </li></ul></ul>
  • 23. Entity Header <ul><li>Mostly used in response message </li></ul><ul><li>Header Description </li></ul><ul><ul><li>Content-encoding Encoding scheme </li></ul></ul><ul><ul><li>Content-language Language </li></ul></ul><ul><ul><li>Content-length Length </li></ul></ul><ul><ul><li>Last-modified Last modification date and time </li></ul></ul><ul><ul><li>Content-type Type of media document </li></ul></ul>
  • 24. HTTP Example <ul><li>Request GET http://www.sachinism.com/index.htm HTTP/1.0 Accept: text/html Accept: image/jpeg </li></ul><ul><li>Response HTTP/1.0 200 OK Date: Thu, 20-Feb-08 09.00.00 GMT Server: Challenger MIME-version: 1.0 Content-length: 2048 &lt;&lt; HTML Body &gt;&gt; </li></ul>
  • 25. A representation of client-server talk - 1 <ul><ul><li>Request GET http://www.sachinism.com/index.htm HTTP/1.0 Accept: text/html Accept: image/jpeg </li></ul></ul>Client Server To Server, “Can you please give me index.htm?”
  • 26. A representation of client-server talk - 2 <ul><ul><li>Response HTTP/1.0 200 OK Date: Thu, 20-Feb-08 09.00.00 GMT Server: Challenger MIME-version: 1.0 Content-length: 2048 &lt;&lt;HTML Body &gt;&gt; </li></ul></ul>Client Server To Client, “ Sure, here it is...” Contents of index.htm
  • 27. A representation of client-server talk - 3 Client Server Wow... I am lucky to get index.htm so fast! Actual webpage, that can be displayed on browser
  • 28. CGI - The Common Gateway Interface <ul><li>CGI is a standard protocol for interfacing external application software with an information server, commonly a web server. </li></ul><ul><li>an information server responds to requests(in the case of web servers, requests from client web browsers) </li></ul><ul><li>Each time a request is received, the server analyzes what the request asks for, and returns the appropriate output. </li></ul>
  • 29. &nbsp;
  • 30. CGI <ul><li>The two simplest ways, for the server, of doing this are the following: </li></ul><ul><li>1) If the request identifies a file stored on disk, return the contents of that file; </li></ul><ul><li>2) If the request identifies an executable command and possibly arguments, run the command and return its output </li></ul>
  • 31. &nbsp;
  • 32. PHP <ul><li>PHP Hyper Processor or Personal Hypertext Processor </li></ul><ul><li>A server side programming language </li></ul><ul><li>Emerged as leading language in server side application development since a decade! </li></ul><ul><li>HTML can simply display data (static) whereas PHP can be executed on server and the result is displayed on client (Dynamic) - will discuss later in this session </li></ul>
  • 33. Why use PHP? <ul><li>1)PHP is a server-side interpreter which is Open Source and free; </li></ul><ul><li>2)So is a growing number of PHP web applications; </li></ul><ul><li>3)PHP provides familiar syntax to C, Perl and Java developers; </li></ul><ul><li>4)PHP has fast connections to popular databases; </li></ul><ul><li>5)PHP has fast native connections to the Open Source MySQL database; </li></ul>
  • 34. Why use PHP? <ul><li>6)PHP runs reliably on Windows, Linux and Mac servers and clients; </li></ul><ul><li>7)PHP web pages run reliably on all the popular browsers; </li></ul><ul><li>8)PHP&apos;s associative arrays are very useful for UI and database apps; </li></ul><ul><li>9)PHP&apos;s object oriented classes are easy to understand; </li></ul><ul><li>10)PHP has been very promiscuous-linking to PDF, SWF, XML, Java, etc, etc. </li></ul>
  • 35. Role of PHP - advantage <ul><li>Everything goes personalize I.E. User settings, look and feel, some private data etc. </li></ul><ul><li>Provides user interactivity </li></ul><ul><li>Allows to create own web applications that can be executed remotely! </li></ul><ul><li>Examples : any website provides login and thereafter services, live cricket scores on sachinism.com </li></ul>
  • 36. HTML/JS VS PHP <ul><li>JavaScript = ClientSide; PHP = ServerSide </li></ul><ul><li>With php you can have the remote time, with js you can have user time... </li></ul><ul><li>with php the source is not lookable in the source code with js the source can be see in the source code of the page. </li></ul><ul><li>Javascript NOT EQUAL TO PHP </li></ul>
  • 37. Recap
  • 38. Summary <ul><li>Internet era began with static webpages written in HTML, which required strict rules – created XHTML. </li></ul><ul><li>Every web based application (essentially webpages / websites) are communicating on HTTP which follow specific format. </li></ul><ul><li>User requests something to server and server sends back relevant data – implements client server architecture. </li></ul><ul><li>Later on, server side programming languages like PHP adds user interactivity, personalisation of websites. </li></ul>
  • 39. Whats next? <ul><li>Starting up with PHP </li></ul><ul><ul><li>Obtaining, Installing and Configuring PHP </li></ul></ul><ul><ul><li>Obtaining PHP Source Code </li></ul></ul><ul><ul><li>Installing PHP from Binary Packages </li></ul></ul><ul><ul><li>Dynamic Extensions, Checking Install with phpinfo() Function. </li></ul></ul>

×