php PHP 4 Internals php Andi Gutmans PHP

  • Slides: 29
Download presentation

<? php. . . PHP 4 Internals <? php. . . Andi Gutmans PHP

<? php. . . PHP 4 Internals <? php. . . Andi Gutmans PHP Group Member & Co-founder of Zend Technologies <? php. . . O’Reilly OSCON Monterey - July 2000

Presentation Overview l What is PHP? Basic features of PHP l How PHP interacts

Presentation Overview l What is PHP? Basic features of PHP l How PHP interacts in the Web Environment l History of PHP l PHP 4 Architecture l l Design Concepts Building Blocks Other Highlights l Future of PHP l PHP Resources

What is PHP? l HTML embedded scripting language l Open source l Native Web

What is PHP? l HTML embedded scripting language l Open source l Native Web server support l Rich selection of extensions for Web developers

Basic Features of PHP l l l Multi-platform language (Linux, Windows NT, BSD, Solaris)

Basic Features of PHP l l l Multi-platform language (Linux, Windows NT, BSD, Solaris) Connectivity to most popular databases (My. SQL, m. SQL, ODBC, Microsoft SQL Server, Oracle, Informix, Sybase) Support of Java, XML, COM/DCOM (on Windows only), LDAP, IMAP

How PHP interacts in the Web Environment

How PHP interacts in the Web Environment

<? php. . . History of PHP <? php. . .

<? php. . . History of PHP <? php. . .

PHP/FI 1 & 2: 1994 -1997 l l l 1994 - Rasmus Lerdorf created

PHP/FI 1 & 2: 1994 -1997 l l l 1994 - Rasmus Lerdorf created PHP/FI, a set of Perl scripts Evolution into PHP/FI 1. 0 and 2. 0, advanced code that understood complex scripts PHP/FI picked up momentum as a multi-purpose Web scripting language

PHP 3: 1997 – 1998 l l Zeev Suraski and I rewrote scripting language

PHP 3: 1997 – 1998 l l Zeev Suraski and I rewrote scripting language and other core functionality Firm establishment of PHP core development group and open-source community l Exponential growth of installed base l Technological advances…

PHP 3: 1997 – 1998 Technological Advances l l Replacement of previous ‘line-by-line’ with

PHP 3: 1997 – 1998 Technological Advances l l Replacement of previous ‘line-by-line’ with ‘whole script analysis’ parsing technique Full-fledged scripting engine - more powerful syntax and functionality l Object oriented programming l Syntax highlighter l Extendibility l Unified Resource management l Performance

PHP 4: 1998 - present l PHP 4 and Zend Engine l First development

PHP 4: 1998 - present l PHP 4 and Zend Engine l First development release – a conceptual quantum leap in design (May 1999 ) l PHP 4 Beta 1 version (July 1999) l Release of PHP 4. 0. 0 (May 2000)

<? php. . . PHP 4 Architecture Design Concepts Building Blocks Other Highlights <?

<? php. . . PHP 4 Architecture Design Concepts Building Blocks Other Highlights <? php. . .

Basic Design Concepts l l Language optimized for writing HTMLembedded web applications Native Web

Basic Design Concepts l l Language optimized for writing HTMLembedded web applications Native Web server support “Compile-first, execute-later” paradigm (fast run-time performance of complex scripts) Zend Engine kernel independent of PHP functional shell

Basic Design Concepts (cont) l l l Independent modular components (Run -time Compiler, Executor,

Basic Design Concepts (cont) l l l Independent modular components (Run -time Compiler, Executor, Functional API) Compatibility with PHP 3 Functional extendibility (plug-in modules such as optimizer)

Building Blocks of PHP 4 l Scripting engine l Web server interface l Extension

Building Blocks of PHP 4 l Scripting engine l Web server interface l Extension support

Building Blocks – Scripting Engine l ‘Compile-first, execute-later’ paradigm l Key benefits l l

Building Blocks – Scripting Engine l ‘Compile-first, execute-later’ paradigm l Key benefits l l Fast & efficient Modular design with well-defined building blocks l Independent of PHP l Feature rich

Building Blocks - Scripting Engine PHP and Zend Engine Interaction

Building Blocks - Scripting Engine PHP and Zend Engine Interaction

Building Blocks - Scripting Engine Speed and Efficiency l Intermediate code l Reference counting

Building Blocks - Scripting Engine Speed and Efficiency l Intermediate code l Reference counting l $two = 2; $copy_of_two = $two; l $employees = array("Amy", "Brenda", "Charlotte"); $hired_employees = $employees; l $table = "oak"; $chair =& $table; $chair = "plastic";

Building Blocks - Scripting Engine Speed and Efficiency l Smart resource management $user_ids=sql_query("select id

Building Blocks - Scripting Engine Speed and Efficiency l Smart resource management $user_ids=sql_query("select id from users"); while ($user=sql_fetch_object($user_ids)) { $result=sql_query("select * from salaries where id=$user->id"); . . . sql_free_result($result); } l Memory caching l High performance extension API

Building Blocks - Scripting Engine Modular Design l l Concrete separation between operational units

Building Blocks - Scripting Engine Modular Design l l Concrete separation between operational units l Compiler l Executor Multi-threading support l l TSRM (Thread-Safe Resource Manager) l Per thread global variables l Virtual current working directory Zend Engine is a building block in itself

Building Blocks - Scripting Engine Feature Rich l l Fewer limitations Object syntax overloading

Building Blocks - Scripting Engine Feature Rich l l Fewer limitations Object syntax overloading support (Java and COM extensions) New language constructs: here-docs, foreach() loops, Boolean and null values Many new features

Building Blocks of PHP 4 l Scripting engine l Web server interface l Extension

Building Blocks of PHP 4 l Scripting engine l Web server interface l Extension support

Building Blocks – Web Server Interface l Goal: Cross Web Server support (Apache, IIS,

Building Blocks – Web Server Interface l Goal: Cross Web Server support (Apache, IIS, Java servlets) l Server abstraction layer (SAPI) l Centralization l l Output buffering support l Possible hook for XSL translator Get/POST/cookie variables (including multi-dimensional arrays)

Building Blocks of PHP 4 l Scripting engine l Web server interface l Extension

Building Blocks of PHP 4 l Scripting engine l Web server interface l Extension support

Building Blocks – Extension Support Improved Extension Support l l l New build system

Building Blocks – Extension Support Improved Extension Support l l l New build system l Easy to add new modules l Loadable module support Script for quick creation of a new extension skeleton Zend API documentation

Other PHP 4 Highlights l Native HTTP session support l Fallback system for clients

Other PHP 4 Highlights l Native HTTP session support l Fallback system for clients that don’t support cookies: Session identifiers carried in the query string of the URL l PCRE (Perl-like regular expressions) l Shockwave l Integrated XML and My. SQL support

Future of PHP l Corba support l XSLT support l New PHP QA initiative

Future of PHP l Corba support l XSLT support l New PHP QA initiative l l Commercial backing by Zend Technologies Zend Engine improvements

PHP Resources l l Websites l http: //www. php. net l http: //www. zend.

PHP Resources l l Websites l http: //www. php. net l http: //www. zend. com Mailing lists l [email protected] php. net l [email protected] php. net