scripting the web
DESCRIPTION
Scripting The Web. Software Freedom Day 2007 14th September 2007 Asia Pacific Institute of Information Technology Colombo, Sri Lanka. Nazly Ahmed . Agenda. What is PHP? History Getting Started Features Extensions Frameworks. What is PHP?. PHP : Hypertext Preprocessor - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/1.jpg)
Software Freedom Day 200714th September 2007
Asia Pacific Institute of Information Technology Colombo, Sri Lanka.
Nazly Ahmed <[email protected]>
Scripting The Web
![Page 2: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/2.jpg)
Agenda
What is PHP?HistoryGetting StartedFeaturesExtensionsFrameworks
![Page 3: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/3.jpg)
What is PHP?
PHP : Hypertext Preprocessor
PHP is a Server-side Scripting Language which can be embedded into HTML
Any PHP tag will be replaced by the Server before its sent back to the client browser
Can be used to collect form data, generate dynamic
page content, send and receive cookies and much more
It’s Open Source – Apache like BSD-style license
![Page 4: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/4.jpg)
Server-side
![Page 5: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/5.jpg)
Server-side
If the PHP file contains
What the end user would get
![Page 6: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/6.jpg)
History of PHPPHP/FI : Personal Home Page / Forms Interpreter
Created by Rasmus Lerdorf in 1995
Perl like syntax
Was able to connect with databases
Enabled users to develop simple Dynamic Web Applications
Code was released for everybody to see
![Page 7: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/7.jpg)
History of PHPPHP/FI 2.0
Released in November 1997
Several people contributing bits of code to this project but still a one-man project.
Several thousand users around the world
50,000 domains reported to have been installed.
![Page 8: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/8.jpg)
History of PHPPHP 3.0Created by Andi Gutmans and Zeev Suraski in 1997 as a complete rewrite
Solid infrastructure for lots of different databases, protocols and APIs
Contains strong extensibility features
Object oriented syntax support
Powerful and consistent language syntax
It was named plain 'PHP', with the meaning being a recursive acronym - PHP: Hypertext Preprocessor
Officially released in June 1998
Installed on 10% of the Web Servers on the Internet
![Page 9: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/9.jpg)
History of PHPPHP 4.0Officially released in May 2000.
Rewrite of PHP's core to improve performance of complex applications, and improve the modularity of PHP's code base.
The new engine, named 'Zend Engine'
Support for many more Web servers, HTTP sessions, output buffering, more secure ways of handling user input and several new language constructs
Installed on 20% of the Web Servers on the Internet
![Page 10: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/10.jpg)
History of PHPPHP 5.0Officially released in July 2004.
Mainly driven by its core, the Zend Engine 2.0 with a new object model and dozens of other new features
Allows the developers to use the full set of object-oriented features
Installed on 34% of the Web Servers on the Internet
PHP 5.2.4 is the latest stable release.
![Page 11: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/11.jpg)
PHP Usage
PHP: 20,016,421 domains, 1,208,663 IP addresses
![Page 12: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/12.jpg)
Who uses PHP?
![Page 13: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/13.jpg)
Projects Powered by PHP
![Page 14: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/14.jpg)
Getting StartedFor Server-side Scripting
o The PHP parser (CGI or server module)o A Web Server o A Web Browser
Supports all major Operating SystemsLinux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X
Supports most of the Web ServersApache, Microsoft IIS, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others.
Download the latest stable release of PHP from http://www.php.net/downloads
Online Manual : http://www.php.net/manual/
![Page 15: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/15.jpg)
Features of PHP (5.0)Long list of internal (built-in) functions
Full set of OOP features Allows the developers to use the full set of object-oriented features which lacked in PHP4.
Improved MySQL supportMySQLi, the MySQL Improved extension offers prepared statements, bound parameters and SSL connections. It also takes advantage of PHP5's new object-oriented support to provide an object-oriented interface to MySQL.
![Page 16: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/16.jpg)
Features of PHP (5.0)Easy handling of XML with SimpleXML
The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object which can be easily processed.
Sessions supportSession support in PHP consists of a way to preserve certain data across subsequent accesses.
Bundled SQLiteSQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine
![Page 17: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/17.jpg)
Features of PHP (5.0)Error handling using exceptions
PHP 5 offers a completely different model of error checking than what's available in PHP 4. It's called exception handling. With exceptions you can separate programming logic from error handling and place them in adjoining blocks of code
Streams and FiltersA way of generalizing file, network, data compression, and other operations which share a common set of functions and uses A filter is a final piece of code which may perform operations on data as it is being read from or written to a stream.
php:// http://, https://, ftp://, ftps://compression.gzip://, compression.bz2://php://filter
![Page 18: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/18.jpg)
Reusable PHP ComponentsPEAR : PHP Extension and Application Repository
PEAR is a framework and distribution system for reusable PHP components.
Consists reusable components for Database, Encryption, Images, Web Services, Authentication, Date and Time, Mail and much more.
http://pear.php.net
![Page 19: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/19.jpg)
ExtensionsPECL : PHP Extension Community Library PECL is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.
Consists extension for Database, Encryption, Images, Web Services, Authentication, Date and Time, Mail and much more.
http://pecl.php.net
![Page 20: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/20.jpg)
PHP FrameworksA structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.
Compatibility with PHP4 and PHP5
Integrated CRUD for database
Interaction and simplified queries
Application Scaffolding
Model View Controller (MVC) Architecture
Custom URLs
Fast and flexible templating
View Helpers for AJAX, Javascript, HTML Forms and more
http://www.cakephp.org/
![Page 21: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/21.jpg)
PHP FrameworksFew other PHP Frameworks that are available
http://framework.zend.com/
http://www.symfony-project.com/
http://www.codeigniter.com/
![Page 22: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/22.jpg)
Resources
PHP : http://www.php.net
MySQL : http://www.mysql.com
SQLite : http://www.sqlite.org
PEAR : http://pear.php.net
PECL : http://pecl.php.net
![Page 23: Scripting The Web](https://reader034.vdocument.in/reader034/viewer/2022051316/56814ac0550346895db7d4a8/html5/thumbnails/23.jpg)
Questions?