Software Freedom Day 2007 14th September 2007 Asia Pacific Institute of Information Technology Colombo, Sri Lanka. Nazly Ahmed <[email protected]> Scripting The Web
Jan 15, 2016
Software Freedom Day 200714th September 2007
Asia Pacific Institute of Information Technology Colombo, Sri Lanka.
Nazly Ahmed <[email protected]>
Scripting The Web
Agenda
What is PHP?HistoryGetting StartedFeaturesExtensionsFrameworks
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
Server-side
Server-side
If the PHP file contains
What the end user would get
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
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.
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
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
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.
PHP Usage
PHP: 20,016,421 domains, 1,208,663 IP addresses
Who uses PHP?
Projects Powered by PHP
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/
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.
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
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
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
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
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/
PHP FrameworksFew other PHP Frameworks that are available
http://framework.zend.com/
http://www.symfony-project.com/
http://www.codeigniter.com/
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
Questions?