cvs: presentations /slides/intro alternative.xml app_arch.xml baby1.xml baby2.xml baby3.xml best.xml book.php book.xml carl.xml cli-awk.xml cpp.xml
flash_ming.xml input_filter.xml ms.xml msstack.png mysql_setup.xml pdf.xml php-basic.xml php-framework.xml php-scripting.xml php-template.xml
php5_call.xml php5_construct.xml php5_domxml-load.xml php5_exceptions.xml php5_private.xml php5_protected.xml php5_refclone.xml php5_setget.xml
php_bench3.xml php_profiling.xml php_tuning2.xml resources.xml simple.png simple.xml simple_form.xml simplexml1.xml simplexml2.xml sqlite1.php
sqlite1.xml sqlite2.php sqlite2.xml stack.png stack.xml stop.xml streams.xml sys_arch.png top25.png xdebug.xml yahoo-numbers.xml
| From: | Rasmus Lerdorf | Date: | Tue, 20 Jan 2004 18:37:17 +0000 |
| Subject: | cvs: presentations /slides/intro alternative.xml app_arch.xml baby1.xml baby2.xml baby3.xml best.xml book.php book.xml carl.xml cli-awk.xml cpp.xml flash_ming.xml input_filter.xml ms.xml msstack.png mysql_setup.xml pdf.xml php-basic.xml php-framework.xml php-scripting.xml php-template.xml php5_call.xml php5_construct.xml php5_domxml-load.xml php5_exceptions.xml php5_private.xml php5_protected.xml php5_refclone.xml php5_setget.xml php_bench3.xml php_profiling.xml php_tuning2.xml resources.xml simple.png simple.xml simple_form.xml simplexml1.xml simplexml2.xml sqlite1.php sqlite1.xml sqlite2.php sqlite2.xml stack.png stack.xml stop.xml streams.xml sys_arch.png top25.png xdebug.xml yahoo-numbers.xml |
||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-940@lists.php.net to get a copy of this message | ||
rasmus Tue Jan 20 13:37:17 2004 EDT
Added files:
/presentations/slides/intro alternative.xml baby1.xml baby2.xml
baby3.xml best.xml book.php book.xml
carl.xml cli-awk.xml cpp.xml
input_filter.xml ms.xml msstack.png
php-basic.xml php-framework.xml
php-scripting.xml php-template.xml
php5_call.xml php5_construct.xml
php5_domxml-load.xml
php5_exceptions.xml php5_private.xml
php5_protected.xml php5_refclone.xml
php5_setget.xml php_bench3.xml
simple.png simple.xml simple_form.xml
simplexml1.xml simplexml2.xml
sqlite1.php sqlite1.xml sqlite2.php
sqlite2.xml stack.png stack.xml
stop.xml streams.xml sys_arch.png
top25.png xdebug.xml yahoo-numbers.xml
Modified files:
/presentations/slides/intro app_arch.xml flash_ming.xml
mysql_setup.xml pdf.xml
php_profiling.xml php_tuning2.xml
resources.xml
Log:
Updated slides
http://cvs.php.net/diff.php/presentations/slides/intro/app_arch.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/intro/app_arch.xml diff -u presentations/slides/intro/app_arch.xml:1.1 presentations/slides/intro/app_arch.xml:1.2 --- presentations/slides/intro/app_arch.xml:1.1 Sat Apr 26 13:52:13 2003 +++ presentations/slides/intro/app_arch.xml Tue Jan 20 13:37:15 2004 @@ -1,6 +1,6 @@ <slide title="App Architecture"> <blurb> -A typical architecture for a PHP application. The template layer should have +A suggested architecture for a PHP application. The template layer should have as little business logic as possible. As you go down you have less presentation and more business logic. </blurb> http://cvs.php.net/diff.php/presentations/slides/intro/flash_ming.xml?r1=1.2&r2=1.3&ty=u Index: presentations/slides/intro/flash_ming.xml diff -u presentations/slides/intro/flash_ming.xml:1.2 presentations/slides/intro/flash_ming.xml:1.3 --- presentations/slides/intro/flash_ming.xml:1.2 Sun Aug 18 17:11:45 2002 +++ presentations/slides/intro/flash_ming.xml Tue Jan 20 13:37:15 2004 @@ -2,13 +2,12 @@ <link leader="See " href="http://www.opaque.net/ming/">http://www.opaque.net/ming/</link> <example - filename="ming.php" result="1" type="flash" fontsize="1.5em" iwidth="500" iheight="300" + filename="ming.php" rwidth="510" /> - </slide> http://cvs.php.net/diff.php/presentations/slides/intro/mysql_setup.xml?r1=1.2&r2=1.3&ty=u Index: presentations/slides/intro/mysql_setup.xml diff -u presentations/slides/intro/mysql_setup.xml:1.2 presentations/slides/intro/mysql_setup.xml:1.3 --- presentations/slides/intro/mysql_setup.xml:1.2 Sun Aug 18 17:11:45 2002 +++ presentations/slides/intro/mysql_setup.xml Tue Jan 20 13:37:15 2004 @@ -4,9 +4,7 @@ <image filename="mysql_info.png" align="center"/> <blurb title="If not enabled"> -Very rare since a MySQL client library is distributed with PHP and built into PHP -by default. However, it is possible to build PHP without MySQL support. Some -possible fixes: +Some possible ways to enable MySQL support: </blurb> <example type="shell"><![CDATA[apt-get install php-mysql]]></example> <example type="shell"><![CDATA[rpm -Uvh php-mysql-4.2.2-1.i386.rpm]]></example> http://cvs.php.net/diff.php/presentations/slides/intro/pdf.xml?r1=1.4&r2=1.5&ty=u Index: presentations/slides/intro/pdf.xml diff -u presentations/slides/intro/pdf.xml:1.4 presentations/slides/intro/pdf.xml:1.5 --- presentations/slides/intro/pdf.xml:1.4 Sat Apr 26 13:44:23 2003 +++ presentations/slides/intro/pdf.xml Tue Jan 20 13:37:15 2004 @@ -2,9 +2,9 @@ <example title="A PDF Invoice" - filename="invoice.php" fontsize="1.5em" result="1" + filename="invoice.php" type="iframe" /> </slide> http://cvs.php.net/diff.php/presentations/slides/intro/php_profiling.xml?r1=1.2&r2=1.3&ty=u Index: presentations/slides/intro/php_profiling.xml diff -u presentations/slides/intro/php_profiling.xml:1.2 presentations/slides/intro/php_profiling.xml:1.3 --- presentations/slides/intro/php_profiling.xml:1.2 Sun Sep 21 11:50:33 2003 +++ presentations/slides/intro/php_profiling.xml Tue Jan 20 13:37:15 2004 @@ -126,4 +126,5 @@ 0.0 0.00 0.25 0.00 0.01 0.00 0.00 6 0.0000 0.0017 208 make_image ]]></example> +<link leader="Xdebug can profile as well: " href="http://www.xdebug.org/docs-profiling.php"/> </slide> http://cvs.php.net/diff.php/presentations/slides/intro/php_tuning2.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/intro/php_tuning2.xml diff -u presentations/slides/intro/php_tuning2.xml:1.1 presentations/slides/intro/php_tuning2.xml:1.2 --- presentations/slides/intro/php_tuning2.xml:1.1 Sat Apr 26 13:52:13 2003 +++ presentations/slides/intro/php_tuning2.xml Tue Jan 20 13:37:15 2004 @@ -24,9 +24,4 @@ echo getenv('DOCUMENT_ROOT'); ?>]]></example> -<table columns="2" border="0" width="100%" align="center" fontsize="3em"> -<cell>PHP 4.3 w/ APC2 and EGPCS</cell><cell>399 requests/sec</cell> -<cell>PHP 4.3 w/ APC2 and GPC</cell><cell>513 requests/sec</cell> -</table> - </slide> http://cvs.php.net/diff.php/presentations/slides/intro/resources.xml?r1=1.2&r2=1.3&ty=u Index: presentations/slides/intro/resources.xml diff -u presentations/slides/intro/resources.xml:1.2 presentations/slides/intro/resources.xml:1.3 --- presentations/slides/intro/resources.xml:1.2 Thu Oct 24 09:27:01 2002 +++ presentations/slides/intro/resources.xml Tue Jan 20 13:37:16 2004 @@ -3,10 +3,11 @@ <blurb> </blurb> <blurb> </blurb> <blurb> </blurb> -<blurb> </blurb> -<blurb> </blurb> <link fontsize="3em" marginleft="3em" leader="Home Page: " href="http://www.php.net"/> <link fontsize="3em" marginleft="3em" leader="Manual: " href="http://php.net/manual"/> -<link fontsize="3em" marginleft="3em" leader="Tutorial: " href="http://php.net/tut.php"/> <link fontsize="3em" marginleft="3em" leader="Books: " href="http://php.net/books.php"/> +<link fontsize="3em" marginleft="3em" leader="Bugs: " href="http://bugs.php.net"/> +<link fontsize="3em" marginleft="3em" leader="PEAR: " href="http://pear.php.net"/> +<link fontsize="3em" marginleft="3em" leader="PECL: " href="http://pecl.php.net"/> +<link fontsize="3em" marginleft="3em" leader="Xdebug: " href="http://xdebug.org"/> </slide> http://cvs.php.net/co.php/presentations/slides/intro/alternative.xml?r=1.1&p=1 Index: presentations/slides/intro/alternative.xml +++ presentations/slides/intro/alternative.xml <slide title="The Alternative"> <blurb title="Hardware"> 5 Dual Processor machines with a good amount of disk and RAM. $3,000 per machine. A good quality Switch. $1,000. Total: _$16,000_. </blurb> <blurb title="Software"> Software costs for this architecture is _$0_. </blurb> <list title="What don't you get?"> <item> (-) Shrinkwrapped packaged solution - more work to configure</item> <item> (-) Someone to call for technical support</item> <item> (+) Ongoing yearly license renewal fees</item> <item> (+) No vendor lock-in</item> <item> (+) Nimda Virus</item> <item> (+) Complete flexibility for both hardware and software</item> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/baby1.xml?r=1.1&p=1 Index: presentations/slides/intro/baby1.xml +++ presentations/slides/intro/baby1.xml <slide title="Carl!"> <image filename="cef.jpg" align="center" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/baby2.xml?r=1.1&p=1 Index: presentations/slides/intro/baby2.xml +++ presentations/slides/intro/baby2.xml <slide title="Carl!"> <image filename="cen.jpg" align="center" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/baby3.xml?r=1.1&p=1 Index: presentations/slides/intro/baby3.xml +++ presentations/slides/intro/baby3.xml <slide title="Carl!"> <image filename="cep.jpg" align="center" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/best.xml?r=1.1&p=1 Index: presentations/slides/intro/best.xml +++ presentations/slides/intro/best.xml <slide title="Killer Apps!"> <blurb> Thousands of cool PHP apps out there. Some better than others. Here are some I use: </blurb> <list> <bullet>Gallery - http://gallery.menalto.com/</bullet> <bullet>SquirrelMail - http://squirrelmail.org</bullet> <bullet>FudForum - http://fud.prohost.org/</bullet> <bullet>Serendipity - http://s9y.org/</bullet> <bullet>Cacti - http://www.raxnet.net/products/cacti/</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/book.php?r=1.1&p=1 Index: presentations/slides/intro/book.php +++ presentations/slides/intro/book.php <?php $books = simplexml_load_file('book.xml'); foreach ($books->book as $book) { echo "{$book->title} was written by {$book->author}<br>\n"; } ?> http://cvs.php.net/co.php/presentations/slides/intro/book.xml?r=1.1&p=1 Index: presentations/slides/intro/book.xml +++ presentations/slides/intro/book.xml <books> <book> <title>The Grapes of Wrath</title> <author>John Steinbeck</author> </book> <book> <title>The Pearl</title> <author>John Steinbeck</author> </book> </books> http://cvs.php.net/co.php/presentations/slides/intro/carl.xml?r=1.1&p=1 Index: presentations/slides/intro/carl.xml +++ presentations/slides/intro/carl.xml <slide title="CArL"> <image filename="img_1912.png" align="center" /> <image filename="img_1917.png" align="center" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/cli-awk.xml?r=1.1&p=1 Index: presentations/slides/intro/cli-awk.xml +++ presentations/slides/intro/cli-awk.xml <slide title="PHP-AWK"> <break lines="3" /> <example fontsize="1.6em"><![CDATA[-B <begin_code> Run PHP <begin_code> before processing input lines -R <code> Run PHP <code> for every input line -F <file> Parse and execute <file> for every input line -E <end_code> Run PHP <end_code> after processing all input lines]]></example> <break lines="2" /> <example fontsize="2em"><![CDATA[$ find . | \ php -B '$l = 0;' \ -R '$l+=count(file($argn));' \ -E 'echo "Lines: $l\n";']]></example> <example fontsize="2em"><![CDATA[Lines: 102643]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/cpp.xml?r=1.1&p=1 Index: presentations/slides/intro/cpp.xml +++ presentations/slides/intro/cpp.xml <slide title="Integrating PHP"> <list title="Making it all talk to each other"> <bullet>C</bullet> <bullet>C++</bullet> <bullet>Shared Libraries</bullet> <bullet>ELF</bullet> <bullet>runtime linker</bullet> </list> <example title="No Function-scoped Static Objects"><![CDATA[void example() { static std::string str; }]]></example> <blurb>gcc 3.x has %-fuse-cxa-atexit% and your libc needs to support __cxa_atexit() in order to solve this problem. Other than that, if you can't change the code, patch PHP to not dlclose() the shared extensions on shutdown to avoid the crash. See %http://lerdorf.com/dlclose.txt% for the patch.</blurb> <blurb title="Throwing C++ exceptions"> If a C++ shared library is loaded by a C runtime, like PHP, you could end up with weird %__throw()% problems. An annoying workaround is to link your C runtime against %libstdc++.so% to prevent the linker from pulling in the %__throw% symbol from %libgcc.a%. </blurb> </slide> http://cvs.php.net/co.php/presentations/slides/intro/input_filter.xml?r=1.1&p=1 Index: presentations/slides/intro/input_filter.xml +++ presentations/slides/intro/input_filter.xml <slide title="Input Filtering"> <blurb> Security in a web application boils down to always checking any user-supplied input data. </blurb> <list title="Exploits"> <bullet>%readfile($filename)%</bullet> <bullet>%system($cmd)%</bullet> <bullet>file uploads into document_root</bullet> <bullet>XSS - Cross Site Scripting hacks</bullet> </list> <example title="Input Filter hook"><![CDATA[PHP_MINIT_FUNCTION(my_input_filter) { sapi_register_input_filter(my_sapi_input_filter); return SUCCESS; }]]></example> <blurb> For a complete example, see %README.input_filter% in the PHP 5 source distribution. For PHP4, you will have to patch your source with http://lerdorf.com/input_filter.txt </blurb> </slide> http://cvs.php.net/co.php/presentations/slides/intro/ms.xml?r=1.1&p=1 Index: presentations/slides/intro/ms.xml +++ presentations/slides/intro/ms.xml <slide title="Is it Worth It?"> <blurb title="Architecture" /> <image filename="sys_arch.png" align="center"/> <blurb title="Hardware"> 5 Dual Processor machines with a good amount of disk and RAM. $3,000 per machine. A good quality Switch. $1,000. Total: _$16,000_. </blurb> <table columns="2" border="0" width="100%" align="left" fontsize="3em" title="Software"> <cell>Microsoft® Windows® Server Enterprise 2003 25 Client x 5</cell><cell>. . $3,919</cell> <cell>Internet Security and Acceleration Server (per cpu) x 2</cell><cell>. . $5,999</cell> <cell>SQL Server 2000 Enterprise Edition (per cpu) x 2</cell><cell>. $19,999</cell> <cell>Exchange Enterprise Server (25 CALs)</cell><cell>. . $6,999</cell> <cell>Commerce Server (per cpu) x 6</cell><cell>. $6,999</cell> <cell>Application Server (per cpu) x 6</cell><cell>. . $2,999</cell> <cell>Content Management Server 2002 (per cpu) x 2</cell><cell align="right">. $39,101</cell> <cell>MSDN Universal Subscription per developer x 2</cell><cell align="right">. . $2,799</cell> <cell>Total:</cell><cell>_$266,174_</cell> </table> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php-basic.xml?r=1.1&p=1 Index: presentations/slides/intro/php-basic.xml +++ presentations/slides/intro/php-basic.xml <slide title="BASIC of the Web"> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>How many kids today have access to programming languages?</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Back in the day when I walked uphill to and from school in a snowstorm every day, every computer had a programming language built in</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Computers and their languages are much more complex today</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>The Web is still relatively simple and PHP is a very accessible language</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php-framework.xml?r=1.1&p=1 Index: presentations/slides/intro/php-framework.xml +++ presentations/slides/intro/php-framework.xml <slide title="Application Framework"> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Very structured approach to problem solving</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Typically object oriented</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Used for large homogenius problem sets</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Promotes Code Reusability</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php-scripting.xml?r=1.1&p=1 Index: presentations/slides/intro/php-scripting.xml +++ presentations/slides/intro/php-scripting.xml <slide title="Scripting Language"> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>High Level</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Dynamically typed</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Immediate Execution</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Strong glue</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php-template.xml?r=1.1&p=1 Index: presentations/slides/intro/php-template.xml +++ presentations/slides/intro/php-template.xml <slide title="Template System"> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>A mechanism to separate logic from layout.</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>The defining characteristic is where and how the intersection between logic and layout is done.</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>PHP is a general-purpose templating system.</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Any general-purpose templating system will eventually become PHP.</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_call.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_call.xml +++ presentations/slides/intro/php5_call.xml <slide title="PHP5 OO - call"> <blurb> __call() is used to catch method calls the same way __get() and __set() is used to catch property accesses </blurb> <example><![CDATA[<?php class hello { function __call($name, $args) { echo "Hello ".ucfirst($name)."!\n"; } } $h = new hello; $h->rusty(); $h->anton(); ?>]]></example> <example><![CDATA[Hello Rusty! Hello Anton!]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_construct.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_construct.xml +++ presentations/slides/intro/php5_construct.xml <slide title="PHP5 OO - *structors"> <example title="Constructors and Destructors"><![CDATA[<?php class OS { function __construct($name) { echo "begin"; } function __destruct() { echo "done"; } } $linux = new OS('linux'); $linux = NULL; ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_domxml-load.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_domxml-load.xml +++ presentations/slides/intro/php5_domxml-load.xml <slide title="DOMXML load"> <example><![CDATA[<?php $doc = domxml_open_file('book.xml'); $root = $doc->child_nodes(); $root = $root[0]; $books = $root->child_nodes(); foreach ($books as $book) { if (@$book->tagname == 'book') { $content = $book->child_nodes(); foreach ($content as $elem) { if (@$elem->tagname == 'author') { $author = $elem->get_content(); } if (@$elem->tagname == 'title') { $title = $elem->get_content(); } } echo "{$title} was written by {$author}\n"; } } ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_exceptions.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_exceptions.xml +++ presentations/slides/intro/php5_exceptions.xml <slide title="PHP5 OO - Exceptions"> <example title="PHP4:"><![CDATA[<?php if (mysql_connect('localhost')) { if (mysql_select_db('game')) { $r = mysql_query('SELECT * FROM news'); ...]]></example> <example title="PHP5:"><![CDATA[<?php try { mysql_connect('localhost'); mysql_select_db('game'); $r = mysql_query('SELECT * FROM news'); } catch (Exception $e) { /* Do recovery */ exit(); }]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_private.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_private.xml +++ presentations/slides/intro/php5_private.xml <slide title="PHP5 OO - Private"> <list> <bullet>'Strongest' access level</bullet> <bullet>Can only be accessed/called from the same class</bullet> <bullet>Force use of get()/set() functions to access properties</bullet> </list> <break lines="1" /> <example><![CDATA[<?php class Bedroom { private $action; function __construct() { $this->action = 'fun'; } } $br = new Bedroom(); echo $br->action. "\n"; ?>]]></example> <example><![CDATA[Fatal error: Cannot access private property bedroom::$action in foo.php on line 12]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_protected.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_protected.xml +++ presentations/slides/intro/php5_protected.xml <slide title="PHP5 OO - Protected"> <blurb> Only accessable/callable by the same, or an inherited class. </blurb> <example><![CDATA[<?php class Bedroom { protected $action; function __construct() { $this->action = 'fun'; } protected function peek() { echo $this->action. "\n"; } } class Keyhole extends Bedroom { function peek() { echo $this->action. "\n"; } } $kh = new Keyhole(); $kh->peek(); $br = new Bedroom(); $br->peek(); /* Doesn't work */ ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_refclone.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_refclone.xml +++ presentations/slides/intro/php5_refclone.xml <slide title="PHP5 OO - References"> <example title="In PHP4" result="1"><![CDATA[<?php class OS { var $name; function OS($name) { $this->name = $name; } } function changeName(&$obj, $name) { $obj->name = $name; } $linux = new OS('linux'); $win = $linux; changeName($win, 'windows'); echo $linux->name. "<br />\n"; echo $win->name; ?>]]></example> <example title="In PHP5"><![CDATA[<?php class OS { var $name; function OS($name) { $this->name = $name; } } function changeName($obj, $name) { $obj->name = $name; } $linux = new OS('linux'); $win = $linux->__clone(); changeName($win, 'windows'); echo $linux->name. "\n"; echo $win->name; ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_setget.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_setget.xml +++ presentations/slides/intro/php5_setget.xml <slide title="PHP5 OO - set/get"> <blurb> Property access handlers combined with 'private' can be used as a replacement for dynamic properties. </blurb> <example fontsize="2em"><![CDATA[<?php class OSses { private $names = array(); public function __set($name, $value) { if (!in_array($name, array('windows', 'dos'))) $this->names[$name] = $value; } public function getNames() { return $this->names; } } $osses = new OSses(); $osses->linux = 'rocks'; $osses->windows = 'blows'; var_dump($osses->getNames()); ?>]]></example> <example><![CDATA[array(1) { ["linux"]=> string(5) "rocks" }]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php_bench3.xml?r=1.1&p=1 Index: presentations/slides/intro/php_bench3.xml +++ presentations/slides/intro/php_bench3.xml <slide title="Benchmarking Results"> <blurb> So, we have determined we are cpu-bound and we need to go faster. What can we do? Some low-hanging fruit: </blurb> <example title="include_path" type="shell"> include_path = "/usr/share/pear:." </example> <example><![CDATA[<?php include './template_helpers.inc'; include 'business_logic.inc'; ?>]]></example> <example title="open_basedir" type="shell" fontsize="1.75em"> open_basedir = "/usr/share/htdocs/:/usr/share/pear/" </example> <blurb>open_basedir checking adds some extra syscalls to every file operation. It can be useful, but it is rather expensive, so turn it off if you don't think you need it.</blurb> <example title="variables_order" type="shell"> variables_order = "GPC" </example> <example><![CDATA[<?php echo $_SERVER['DOCUMENT_ROOT']; echo getenv('DOCUMENT_ROOT'); ?>]]></example> <blurb>If you never use cookies, turn those off too</blurb> <example title="Add an Opcode Cache"> zend_extension=/usr/local/lib/php/20020429/apc.so apc.enabled=1 apc.shm_segments=1 apc.optimization=0 apc.shm_size=30 apc.num_files_hint=10 apc.gc_ttl=10 apc.mmap_file_mask=/tmp/apc.XXXXXX apc.filters= </example> <table title="Results" columns="3" border="0" width="100%" align="center" fontsize="2.5em"> <cell>156 request/sec</cell><cell>Standard PHP 4.3</cell><cell></cell> <cell>161 requests/sec</cell><cell>Fix include_path, and only populate GP</cell><cell></cell> <cell>191 requests/sec</cell><cell>Add IonCube Accelerator on top</cell><cell></cell> <cell>196 requests/sec</cell><cell>APC no optimizer, IPC shared mem + semaphore locking</cell><cell></cell> <cell>198 requests/sec</cell><cell>Turck MMCache no optimizer with spinlocks</cell><cell></cell> <cell>200 requests/sec</cell><cell>APC no optimizer, mmap mem + user space sleep locks</cell><cell></cell> <cell>202 requests/sec</cell><cell>Turck MMCache with optimizer and spinlocks</cell><cell></cell> </table> </slide> http://cvs.php.net/co.php/presentations/slides/intro/simple.xml?r=1.1&p=1 Index: presentations/slides/intro/simple.xml +++ presentations/slides/intro/simple.xml <slide title="The Web Problem"> <image filename="simple.png" align="center" /> <list fontsize="5.5em"> <item>The Web Problem is simple!</item> <item>The Web Solution is often overly complex.</item> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/simple_form.xml?r=1.1&p=1 Index: presentations/slides/intro/simple_form.xml +++ presentations/slides/intro/simple_form.xml <slide title="Form Handling"> <example title="Traditional Form Handling" result="1"><![CDATA[<form action="<?=$PHP_SELF?>" method="POST"> Your name: <input type=text name=name><br> You age: <input type=text name=age><br> <input type=submit> </form>]]></example> <example title="Receiving Script" result="1" condition="name"><![CDATA[Hi <?echo $name?>. You are <?echo $age?> years old.]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/simplexml1.xml?r=1.1&p=1 Index: presentations/slides/intro/simplexml1.xml +++ presentations/slides/intro/simplexml1.xml <slide title="Simple XML"> <blurb>No more SAX parsing and we get DTD validation and XPath queries</blurb> <example title="Book XML File"><![CDATA[<books> <book> <title>The Grapes of Wrath</title> <author>John Steinbeck</author> </book> <book> <title>The Pearl</title> <author>John Steinbeck</author> </book> </books>]]></example> <example title="Book PHP File"><![CDATA[<?php $books = simplexml_load_file('book.xml'); foreach ($books->book as $book) { echo "{$book->title} was written by {$book->author}<br>\n"; } ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/simplexml2.xml?r=1.1&p=1 Index: presentations/slides/intro/simplexml2.xml +++ presentations/slides/intro/simplexml2.xml <slide title="Simple RDF"> <blurb fontsize="3em">World's Easiest RDF parser?</blurb> <example fontsize="2em" result="0"><![CDATA[<?php $rdf = simplexml_load_file('rss_feed.rdf'); echo $rdf->channel->title; foreach ($rdf->channel->item as $item) { echo '<a href="'.$item->link.'">' . $item->title . '</a>'; } ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/sqlite1.php?r=1.1&p=1 Index: presentations/slides/intro/sqlite1.php +++ presentations/slides/intro/sqlite1.php <?php @exec('rm /tmp/lb.db'); $db = sqlite_open('/tmp/lb.db', 0666, $sqliteerror); if ($db) { sqlite_query($db, 'CREATE TABLE foo (bar varchar(10))'); sqlite_query($db, "INSERT INTO foo VALUES ('fnord')"); $result = sqlite_query($db,'select bar from foo'); $record = sqlite_fetch_array($result); var_dump($record); } else { die ($sqliteerror); } ?> http://cvs.php.net/co.php/presentations/slides/intro/sqlite1.xml?r=1.1&p=1 Index: presentations/slides/intro/sqlite1.xml +++ presentations/slides/intro/sqlite1.xml <slide title="SQLite"> <blurb>SQL Interface for flat files!</blurb> <example title="Example" fontsize="1.6em" result="1"><![CDATA[<?php @exec('rm /tmp/lb.db'); $db = sqlite_open('/tmp/lb.db', 0666, $sqliteerror); if ($db) { sqlite_query($db, 'CREATE TABLE foo (bar varchar(10))'); sqlite_query($db, "INSERT INTO foo VALUES ('fnord')"); $result = sqlite_query($db,'select bar from foo'); $record = sqlite_fetch_array($result); var_dump($record); } else { die ($sqliteerror); } ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/sqlite2.php?r=1.1&p=1 Index: presentations/slides/intro/sqlite2.php +++ presentations/slides/intro/sqlite2.php <?php $db = new sqlite_db(':memory:'); $db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))"); $db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)"); $r = $db->query("SELECT * from foo"); $result = $r->fetch_array(); ?> http://cvs.php.net/co.php/presentations/slides/intro/sqlite2.xml?r=1.1&p=1 Index: presentations/slides/intro/sqlite2.xml +++ presentations/slides/intro/sqlite2.xml <slide title="SQLite">> <blurb>Same thing with the OO interface</blurb> <example title="Example" fontsize="1.5em" type="php" result="0"><![CDATA[<?php $db = new sqlite_db(':memory:'); $db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))"); $db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)"); $r = $db->query("SELECT * from foo"); $result = $r->fetch_array(); ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/stack.xml?r=1.1&p=1 Index: presentations/slides/intro/stack.xml +++ presentations/slides/intro/stack.xml <slide title="Where is the money?"> <blurb title="Verticals!"> The money is where it has always been, _in the verticals_! </blurb> <list> <item>Customers care about the solution, not implementation details</item> <item>Vendor has more control and flexibility with Open Source horizontal components</item> <item>Vendor avoids paying per-seat licensing fees which directly improves the bottom-line</item> </list> <image filename="stack.png" /> <image filename="msstack.png" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/stop.xml?r=1.1&p=1 Index: presentations/slides/intro/stop.xml +++ presentations/slides/intro/stop.xml <slide title="Stop!"> <blurb> One of the most important aspects of performance tuning and even programming in general is knowing when to stop. Getting your web site or product into the hands of the customer is after all the goal of all this. If you sit around and fiddle with it for months, nobody is using it. </blurb> <image filename="dlt800x600.jpg" align="center" /> <blurb> Once you have located all the low-hanging fruit, further optimization tends to get exponentially harder for less and less gain. The time you spend on it compared to simply buying another server or two is usually not worth it. Stop and move onto the next project. </blurb> <blurb> Or better yet, go home, spend some time away from these beastly computers and spend some time with your wife and/or kids </blurb> </slide> http://cvs.php.net/co.php/presentations/slides/intro/streams.xml?r=1.1&p=1 Index: presentations/slides/intro/streams.xml +++ presentations/slides/intro/streams.xml <slide title="Streams and filters"> <break /> <example><![CDATA[<?php echo "<pre>"; print_r(stream_get_wrappers()); print_r(stream_get_filters()); echo "</pre>"; ?>]]></example> <example fontsize="1.8em"><![CDATA[Array ( [0] => php [1] => file [2] => http [3] => ftp [4] => compress.zlib ) Array ( [0] => string.rot13 [1] => string.toupper [2] => string.tolower [3] => string.strip_tags [4] => convert.* )]]></example> <example title="Examples" fontsize="1.4em"><![CDATA[<?php readfile("php://filter/read=string.toupper/resource=http://www.example.com"); $fp = fopen("compress.zlib://foo-bar.txt.gz", "wb"); $httpsfile = file_get_contents("https://www.example.com/foo.txt"); $sock = fsockopen("ssl://secure.example.com", 443, $errno, $errstr, 30); ?>]]></example> <example title="stream_copy_to_stream" fontsize="1.4em"><![CDATA[<?php $src = fopen('http://www.example.com','r'); $dest1 = fopen('first1k.txt','w'); $dest2 = fopen('remainder.txt','w'); stream_copy_to_stream($src, $dest1, 1024); stream_copy_to_stream($src, $dest2); ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/xdebug.xml?r=1.1&p=1 Index: presentations/slides/intro/xdebug.xml +++ presentations/slides/intro/xdebug.xml <slide title="xdebug"> <example title="Installing Xdebug" fontsize="1.3em" type="shell"><![CDATA[pear -v install http://files.derickrethans.nl/xdebug-1.3.0.tgz + create dir /usr/local/lib/php/docs/xdebug 52 source files, building building in /tmp/tmpH4fmdM/xdebug-1.3.0 running: phpize Configuring for: PHP Api Version: 20020918 Zend Module Api No: 20020429 Zend Extension Api No: 20021010 building in /var/tmp/pear-build-root/xdebug-1.3.0 running: /tmp/tmpH4fmdM/xdebug-1.3.0/configure checking build system type... i686-redhat-linux-gnu checking host system type... i686-redhat-linux-gnu checking for gcc... gcc checking for C compiler default output... a.out ... Build process completed successfully Installing 'xdebug.so' at ext_dir (/usr/local/lib/php/extensions/no-debug-non-zts-20020429/xdebug.so) about to commit 16 file operations successfully committed 16 file operations install ok: xdebug 1.3.0]]></example> <example title="Stack trace" result="1"><![CDATA[<?php xdebug_start_trace(); function a() { b(); } function b() { xdebug_dump_function_trace(); } a(); ?>]]></example> <example title="Modified error handler" result="1"><![CDATA[<?php echo $a[1]; ?>]]></example> <example title="Modified var_dump()" result="1"><![CDATA[<?php var_dump($_COOKIE); ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/yahoo-numbers.xml?r=1.1&p=1 Index: presentations/slides/intro/yahoo-numbers.xml +++ presentations/slides/intro/yahoo-numbers.xml <slide title="Yahoo! is Big!"> <list> <title>March 2003 Numbers</title> <bullet>232 million visitors per month</bullet> <bullet>112 million active registered users</bullet> <bullet>2.9 million fee paying customers</bullet> <bullet>1.9 billion average daily page requests</bullet> </list> <image marginleft="4em" clear="left" filename="top25.png" title="Top 25 Global Web Destinations"/> <blurb>Source: Nielsen//NetRatings</blurb> </slide>
http://cvs.php.net/diff.php/presentations/slides/intro/app_arch.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/intro/app_arch.xml diff -u presentations/slides/intro/app_arch.xml:1.1 presentations/slides/intro/app_arch.xml:1.2 --- presentations/slides/intro/app_arch.xml:1.1 Sat Apr 26 13:52:13 2003 +++ presentations/slides/intro/app_arch.xml Tue Jan 20 13:37:15 2004 @@ -1,6 +1,6 @@ <slide title="App Architecture"> <blurb> -A typical architecture for a PHP application. The template layer should have +A suggested architecture for a PHP application. The template layer should have as little business logic as possible. As you go down you have less presentation and more business logic. </blurb> http://cvs.php.net/diff.php/presentations/slides/intro/flash_ming.xml?r1=1.2&r2=1.3&ty=u Index: presentations/slides/intro/flash_ming.xml diff -u presentations/slides/intro/flash_ming.xml:1.2 presentations/slides/intro/flash_ming.xml:1.3 --- presentations/slides/intro/flash_ming.xml:1.2 Sun Aug 18 17:11:45 2002 +++ presentations/slides/intro/flash_ming.xml Tue Jan 20 13:37:15 2004 @@ -2,13 +2,12 @@ <link leader="See " href="http://www.opaque.net/ming/">http://www.opaque.net/ming/</link> <example - filename="ming.php" result="1" type="flash" fontsize="1.5em" iwidth="500" iheight="300" + filename="ming.php" rwidth="510" /> - </slide> http://cvs.php.net/diff.php/presentations/slides/intro/mysql_setup.xml?r1=1.2&r2=1.3&ty=u Index: presentations/slides/intro/mysql_setup.xml diff -u presentations/slides/intro/mysql_setup.xml:1.2 presentations/slides/intro/mysql_setup.xml:1.3 --- presentations/slides/intro/mysql_setup.xml:1.2 Sun Aug 18 17:11:45 2002 +++ presentations/slides/intro/mysql_setup.xml Tue Jan 20 13:37:15 2004 @@ -4,9 +4,7 @@ <image filename="mysql_info.png" align="center"/> <blurb title="If not enabled"> -Very rare since a MySQL client library is distributed with PHP and built into PHP -by default. However, it is possible to build PHP without MySQL support. Some -possible fixes: +Some possible ways to enable MySQL support: </blurb> <example type="shell"><![CDATA[apt-get install php-mysql]]></example> <example type="shell"><![CDATA[rpm -Uvh php-mysql-4.2.2-1.i386.rpm]]></example> http://cvs.php.net/diff.php/presentations/slides/intro/pdf.xml?r1=1.4&r2=1.5&ty=u Index: presentations/slides/intro/pdf.xml diff -u presentations/slides/intro/pdf.xml:1.4 presentations/slides/intro/pdf.xml:1.5 --- presentations/slides/intro/pdf.xml:1.4 Sat Apr 26 13:44:23 2003 +++ presentations/slides/intro/pdf.xml Tue Jan 20 13:37:15 2004 @@ -2,9 +2,9 @@ <example title="A PDF Invoice" - filename="invoice.php" fontsize="1.5em" result="1" + filename="invoice.php" type="iframe" /> </slide> http://cvs.php.net/diff.php/presentations/slides/intro/php_profiling.xml?r1=1.2&r2=1.3&ty=u Index: presentations/slides/intro/php_profiling.xml diff -u presentations/slides/intro/php_profiling.xml:1.2 presentations/slides/intro/php_profiling.xml:1.3 --- presentations/slides/intro/php_profiling.xml:1.2 Sun Sep 21 11:50:33 2003 +++ presentations/slides/intro/php_profiling.xml Tue Jan 20 13:37:15 2004 @@ -126,4 +126,5 @@ 0.0 0.00 0.25 0.00 0.01 0.00 0.00 6 0.0000 0.0017 208 make_image ]]></example> +<link leader="Xdebug can profile as well: " href="http://www.xdebug.org/docs-profiling.php"/> </slide> http://cvs.php.net/diff.php/presentations/slides/intro/php_tuning2.xml?r1=1.1&r2=1.2&ty=u Index: presentations/slides/intro/php_tuning2.xml diff -u presentations/slides/intro/php_tuning2.xml:1.1 presentations/slides/intro/php_tuning2.xml:1.2 --- presentations/slides/intro/php_tuning2.xml:1.1 Sat Apr 26 13:52:13 2003 +++ presentations/slides/intro/php_tuning2.xml Tue Jan 20 13:37:15 2004 @@ -24,9 +24,4 @@ echo getenv('DOCUMENT_ROOT'); ?>]]></example> -<table columns="2" border="0" width="100%" align="center" fontsize="3em"> -<cell>PHP 4.3 w/ APC2 and EGPCS</cell><cell>399 requests/sec</cell> -<cell>PHP 4.3 w/ APC2 and GPC</cell><cell>513 requests/sec</cell> -</table> - </slide> http://cvs.php.net/diff.php/presentations/slides/intro/resources.xml?r1=1.2&r2=1.3&ty=u Index: presentations/slides/intro/resources.xml diff -u presentations/slides/intro/resources.xml:1.2 presentations/slides/intro/resources.xml:1.3 --- presentations/slides/intro/resources.xml:1.2 Thu Oct 24 09:27:01 2002 +++ presentations/slides/intro/resources.xml Tue Jan 20 13:37:16 2004 @@ -3,10 +3,11 @@ <blurb> </blurb> <blurb> </blurb> <blurb> </blurb> -<blurb> </blurb> -<blurb> </blurb> <link fontsize="3em" marginleft="3em" leader="Home Page: " href="http://www.php.net"/> <link fontsize="3em" marginleft="3em" leader="Manual: " href="http://php.net/manual"/> -<link fontsize="3em" marginleft="3em" leader="Tutorial: " href="http://php.net/tut.php"/> <link fontsize="3em" marginleft="3em" leader="Books: " href="http://php.net/books.php"/> +<link fontsize="3em" marginleft="3em" leader="Bugs: " href="http://bugs.php.net"/> +<link fontsize="3em" marginleft="3em" leader="PEAR: " href="http://pear.php.net"/> +<link fontsize="3em" marginleft="3em" leader="PECL: " href="http://pecl.php.net"/> +<link fontsize="3em" marginleft="3em" leader="Xdebug: " href="http://xdebug.org"/> </slide> http://cvs.php.net/co.php/presentations/slides/intro/alternative.xml?r=1.1&p=1 Index: presentations/slides/intro/alternative.xml +++ presentations/slides/intro/alternative.xml <slide title="The Alternative"> <blurb title="Hardware"> 5 Dual Processor machines with a good amount of disk and RAM. $3,000 per machine. A good quality Switch. $1,000. Total: _$16,000_. </blurb> <blurb title="Software"> Software costs for this architecture is _$0_. </blurb> <list title="What don't you get?"> <item> (-) Shrinkwrapped packaged solution - more work to configure</item> <item> (-) Someone to call for technical support</item> <item> (+) Ongoing yearly license renewal fees</item> <item> (+) No vendor lock-in</item> <item> (+) Nimda Virus</item> <item> (+) Complete flexibility for both hardware and software</item> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/baby1.xml?r=1.1&p=1 Index: presentations/slides/intro/baby1.xml +++ presentations/slides/intro/baby1.xml <slide title="Carl!"> <image filename="cef.jpg" align="center" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/baby2.xml?r=1.1&p=1 Index: presentations/slides/intro/baby2.xml +++ presentations/slides/intro/baby2.xml <slide title="Carl!"> <image filename="cen.jpg" align="center" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/baby3.xml?r=1.1&p=1 Index: presentations/slides/intro/baby3.xml +++ presentations/slides/intro/baby3.xml <slide title="Carl!"> <image filename="cep.jpg" align="center" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/best.xml?r=1.1&p=1 Index: presentations/slides/intro/best.xml +++ presentations/slides/intro/best.xml <slide title="Killer Apps!"> <blurb> Thousands of cool PHP apps out there. Some better than others. Here are some I use: </blurb> <list> <bullet>Gallery - http://gallery.menalto.com/</bullet> <bullet>SquirrelMail - http://squirrelmail.org</bullet> <bullet>FudForum - http://fud.prohost.org/</bullet> <bullet>Serendipity - http://s9y.org/</bullet> <bullet>Cacti - http://www.raxnet.net/products/cacti/</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/book.php?r=1.1&p=1 Index: presentations/slides/intro/book.php +++ presentations/slides/intro/book.php <?php $books = simplexml_load_file('book.xml'); foreach ($books->book as $book) { echo "{$book->title} was written by {$book->author}<br>\n"; } ?> http://cvs.php.net/co.php/presentations/slides/intro/book.xml?r=1.1&p=1 Index: presentations/slides/intro/book.xml +++ presentations/slides/intro/book.xml <books> <book> <title>The Grapes of Wrath</title> <author>John Steinbeck</author> </book> <book> <title>The Pearl</title> <author>John Steinbeck</author> </book> </books> http://cvs.php.net/co.php/presentations/slides/intro/carl.xml?r=1.1&p=1 Index: presentations/slides/intro/carl.xml +++ presentations/slides/intro/carl.xml <slide title="CArL"> <image filename="img_1912.png" align="center" /> <image filename="img_1917.png" align="center" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/cli-awk.xml?r=1.1&p=1 Index: presentations/slides/intro/cli-awk.xml +++ presentations/slides/intro/cli-awk.xml <slide title="PHP-AWK"> <break lines="3" /> <example fontsize="1.6em"><![CDATA[-B <begin_code> Run PHP <begin_code> before processing input lines -R <code> Run PHP <code> for every input line -F <file> Parse and execute <file> for every input line -E <end_code> Run PHP <end_code> after processing all input lines]]></example> <break lines="2" /> <example fontsize="2em"><![CDATA[$ find . | \ php -B '$l = 0;' \ -R '$l+=count(file($argn));' \ -E 'echo "Lines: $l\n";']]></example> <example fontsize="2em"><![CDATA[Lines: 102643]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/cpp.xml?r=1.1&p=1 Index: presentations/slides/intro/cpp.xml +++ presentations/slides/intro/cpp.xml <slide title="Integrating PHP"> <list title="Making it all talk to each other"> <bullet>C</bullet> <bullet>C++</bullet> <bullet>Shared Libraries</bullet> <bullet>ELF</bullet> <bullet>runtime linker</bullet> </list> <example title="No Function-scoped Static Objects"><![CDATA[void example() { static std::string str; }]]></example> <blurb>gcc 3.x has %-fuse-cxa-atexit% and your libc needs to support __cxa_atexit() in order to solve this problem. Other than that, if you can't change the code, patch PHP to not dlclose() the shared extensions on shutdown to avoid the crash. See %http://lerdorf.com/dlclose.txt% for the patch.</blurb> <blurb title="Throwing C++ exceptions"> If a C++ shared library is loaded by a C runtime, like PHP, you could end up with weird %__throw()% problems. An annoying workaround is to link your C runtime against %libstdc++.so% to prevent the linker from pulling in the %__throw% symbol from %libgcc.a%. </blurb> </slide> http://cvs.php.net/co.php/presentations/slides/intro/input_filter.xml?r=1.1&p=1 Index: presentations/slides/intro/input_filter.xml +++ presentations/slides/intro/input_filter.xml <slide title="Input Filtering"> <blurb> Security in a web application boils down to always checking any user-supplied input data. </blurb> <list title="Exploits"> <bullet>%readfile($filename)%</bullet> <bullet>%system($cmd)%</bullet> <bullet>file uploads into document_root</bullet> <bullet>XSS - Cross Site Scripting hacks</bullet> </list> <example title="Input Filter hook"><![CDATA[PHP_MINIT_FUNCTION(my_input_filter) { sapi_register_input_filter(my_sapi_input_filter); return SUCCESS; }]]></example> <blurb> For a complete example, see %README.input_filter% in the PHP 5 source distribution. For PHP4, you will have to patch your source with http://lerdorf.com/input_filter.txt </blurb> </slide> http://cvs.php.net/co.php/presentations/slides/intro/ms.xml?r=1.1&p=1 Index: presentations/slides/intro/ms.xml +++ presentations/slides/intro/ms.xml <slide title="Is it Worth It?"> <blurb title="Architecture" /> <image filename="sys_arch.png" align="center"/> <blurb title="Hardware"> 5 Dual Processor machines with a good amount of disk and RAM. $3,000 per machine. A good quality Switch. $1,000. Total: _$16,000_. </blurb> <table columns="2" border="0" width="100%" align="left" fontsize="3em" title="Software"> <cell>Microsoft® Windows® Server Enterprise 2003 25 Client x 5</cell><cell>. . $3,919</cell> <cell>Internet Security and Acceleration Server (per cpu) x 2</cell><cell>. . $5,999</cell> <cell>SQL Server 2000 Enterprise Edition (per cpu) x 2</cell><cell>. $19,999</cell> <cell>Exchange Enterprise Server (25 CALs)</cell><cell>. . $6,999</cell> <cell>Commerce Server (per cpu) x 6</cell><cell>. $6,999</cell> <cell>Application Server (per cpu) x 6</cell><cell>. . $2,999</cell> <cell>Content Management Server 2002 (per cpu) x 2</cell><cell align="right">. $39,101</cell> <cell>MSDN Universal Subscription per developer x 2</cell><cell align="right">. . $2,799</cell> <cell>Total:</cell><cell>_$266,174_</cell> </table> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php-basic.xml?r=1.1&p=1 Index: presentations/slides/intro/php-basic.xml +++ presentations/slides/intro/php-basic.xml <slide title="BASIC of the Web"> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>How many kids today have access to programming languages?</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Back in the day when I walked uphill to and from school in a snowstorm every day, every computer had a programming language built in</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Computers and their languages are much more complex today</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>The Web is still relatively simple and PHP is a very accessible language</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php-framework.xml?r=1.1&p=1 Index: presentations/slides/intro/php-framework.xml +++ presentations/slides/intro/php-framework.xml <slide title="Application Framework"> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Very structured approach to problem solving</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Typically object oriented</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Used for large homogenius problem sets</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Promotes Code Reusability</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php-scripting.xml?r=1.1&p=1 Index: presentations/slides/intro/php-scripting.xml +++ presentations/slides/intro/php-scripting.xml <slide title="Scripting Language"> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>High Level</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Dynamically typed</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Immediate Execution</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Strong glue</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php-template.xml?r=1.1&p=1 Index: presentations/slides/intro/php-template.xml +++ presentations/slides/intro/php-template.xml <slide title="Template System"> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>A mechanism to separate logic from layout.</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>The defining characteristic is where and how the intersection between logic and layout is done.</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>PHP is a general-purpose templating system.</bullet> </list> <image filename="../../../images/blank.gif" align="center" width="1" height="20" /> <list fontsize="5em"> <bullet>Any general-purpose templating system will eventually become PHP.</bullet> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_call.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_call.xml +++ presentations/slides/intro/php5_call.xml <slide title="PHP5 OO - call"> <blurb> __call() is used to catch method calls the same way __get() and __set() is used to catch property accesses </blurb> <example><![CDATA[<?php class hello { function __call($name, $args) { echo "Hello ".ucfirst($name)."!\n"; } } $h = new hello; $h->rusty(); $h->anton(); ?>]]></example> <example><![CDATA[Hello Rusty! Hello Anton!]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_construct.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_construct.xml +++ presentations/slides/intro/php5_construct.xml <slide title="PHP5 OO - *structors"> <example title="Constructors and Destructors"><![CDATA[<?php class OS { function __construct($name) { echo "begin"; } function __destruct() { echo "done"; } } $linux = new OS('linux'); $linux = NULL; ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_domxml-load.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_domxml-load.xml +++ presentations/slides/intro/php5_domxml-load.xml <slide title="DOMXML load"> <example><![CDATA[<?php $doc = domxml_open_file('book.xml'); $root = $doc->child_nodes(); $root = $root[0]; $books = $root->child_nodes(); foreach ($books as $book) { if (@$book->tagname == 'book') { $content = $book->child_nodes(); foreach ($content as $elem) { if (@$elem->tagname == 'author') { $author = $elem->get_content(); } if (@$elem->tagname == 'title') { $title = $elem->get_content(); } } echo "{$title} was written by {$author}\n"; } } ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_exceptions.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_exceptions.xml +++ presentations/slides/intro/php5_exceptions.xml <slide title="PHP5 OO - Exceptions"> <example title="PHP4:"><![CDATA[<?php if (mysql_connect('localhost')) { if (mysql_select_db('game')) { $r = mysql_query('SELECT * FROM news'); ...]]></example> <example title="PHP5:"><![CDATA[<?php try { mysql_connect('localhost'); mysql_select_db('game'); $r = mysql_query('SELECT * FROM news'); } catch (Exception $e) { /* Do recovery */ exit(); }]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_private.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_private.xml +++ presentations/slides/intro/php5_private.xml <slide title="PHP5 OO - Private"> <list> <bullet>'Strongest' access level</bullet> <bullet>Can only be accessed/called from the same class</bullet> <bullet>Force use of get()/set() functions to access properties</bullet> </list> <break lines="1" /> <example><![CDATA[<?php class Bedroom { private $action; function __construct() { $this->action = 'fun'; } } $br = new Bedroom(); echo $br->action. "\n"; ?>]]></example> <example><![CDATA[Fatal error: Cannot access private property bedroom::$action in foo.php on line 12]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_protected.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_protected.xml +++ presentations/slides/intro/php5_protected.xml <slide title="PHP5 OO - Protected"> <blurb> Only accessable/callable by the same, or an inherited class. </blurb> <example><![CDATA[<?php class Bedroom { protected $action; function __construct() { $this->action = 'fun'; } protected function peek() { echo $this->action. "\n"; } } class Keyhole extends Bedroom { function peek() { echo $this->action. "\n"; } } $kh = new Keyhole(); $kh->peek(); $br = new Bedroom(); $br->peek(); /* Doesn't work */ ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_refclone.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_refclone.xml +++ presentations/slides/intro/php5_refclone.xml <slide title="PHP5 OO - References"> <example title="In PHP4" result="1"><![CDATA[<?php class OS { var $name; function OS($name) { $this->name = $name; } } function changeName(&$obj, $name) { $obj->name = $name; } $linux = new OS('linux'); $win = $linux; changeName($win, 'windows'); echo $linux->name. "<br />\n"; echo $win->name; ?>]]></example> <example title="In PHP5"><![CDATA[<?php class OS { var $name; function OS($name) { $this->name = $name; } } function changeName($obj, $name) { $obj->name = $name; } $linux = new OS('linux'); $win = $linux->__clone(); changeName($win, 'windows'); echo $linux->name. "\n"; echo $win->name; ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php5_setget.xml?r=1.1&p=1 Index: presentations/slides/intro/php5_setget.xml +++ presentations/slides/intro/php5_setget.xml <slide title="PHP5 OO - set/get"> <blurb> Property access handlers combined with 'private' can be used as a replacement for dynamic properties. </blurb> <example fontsize="2em"><![CDATA[<?php class OSses { private $names = array(); public function __set($name, $value) { if (!in_array($name, array('windows', 'dos'))) $this->names[$name] = $value; } public function getNames() { return $this->names; } } $osses = new OSses(); $osses->linux = 'rocks'; $osses->windows = 'blows'; var_dump($osses->getNames()); ?>]]></example> <example><![CDATA[array(1) { ["linux"]=> string(5) "rocks" }]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/php_bench3.xml?r=1.1&p=1 Index: presentations/slides/intro/php_bench3.xml +++ presentations/slides/intro/php_bench3.xml <slide title="Benchmarking Results"> <blurb> So, we have determined we are cpu-bound and we need to go faster. What can we do? Some low-hanging fruit: </blurb> <example title="include_path" type="shell"> include_path = "/usr/share/pear:." </example> <example><![CDATA[<?php include './template_helpers.inc'; include 'business_logic.inc'; ?>]]></example> <example title="open_basedir" type="shell" fontsize="1.75em"> open_basedir = "/usr/share/htdocs/:/usr/share/pear/" </example> <blurb>open_basedir checking adds some extra syscalls to every file operation. It can be useful, but it is rather expensive, so turn it off if you don't think you need it.</blurb> <example title="variables_order" type="shell"> variables_order = "GPC" </example> <example><![CDATA[<?php echo $_SERVER['DOCUMENT_ROOT']; echo getenv('DOCUMENT_ROOT'); ?>]]></example> <blurb>If you never use cookies, turn those off too</blurb> <example title="Add an Opcode Cache"> zend_extension=/usr/local/lib/php/20020429/apc.so apc.enabled=1 apc.shm_segments=1 apc.optimization=0 apc.shm_size=30 apc.num_files_hint=10 apc.gc_ttl=10 apc.mmap_file_mask=/tmp/apc.XXXXXX apc.filters= </example> <table title="Results" columns="3" border="0" width="100%" align="center" fontsize="2.5em"> <cell>156 request/sec</cell><cell>Standard PHP 4.3</cell><cell></cell> <cell>161 requests/sec</cell><cell>Fix include_path, and only populate GP</cell><cell></cell> <cell>191 requests/sec</cell><cell>Add IonCube Accelerator on top</cell><cell></cell> <cell>196 requests/sec</cell><cell>APC no optimizer, IPC shared mem + semaphore locking</cell><cell></cell> <cell>198 requests/sec</cell><cell>Turck MMCache no optimizer with spinlocks</cell><cell></cell> <cell>200 requests/sec</cell><cell>APC no optimizer, mmap mem + user space sleep locks</cell><cell></cell> <cell>202 requests/sec</cell><cell>Turck MMCache with optimizer and spinlocks</cell><cell></cell> </table> </slide> http://cvs.php.net/co.php/presentations/slides/intro/simple.xml?r=1.1&p=1 Index: presentations/slides/intro/simple.xml +++ presentations/slides/intro/simple.xml <slide title="The Web Problem"> <image filename="simple.png" align="center" /> <list fontsize="5.5em"> <item>The Web Problem is simple!</item> <item>The Web Solution is often overly complex.</item> </list> </slide> http://cvs.php.net/co.php/presentations/slides/intro/simple_form.xml?r=1.1&p=1 Index: presentations/slides/intro/simple_form.xml +++ presentations/slides/intro/simple_form.xml <slide title="Form Handling"> <example title="Traditional Form Handling" result="1"><![CDATA[<form action="<?=$PHP_SELF?>" method="POST"> Your name: <input type=text name=name><br> You age: <input type=text name=age><br> <input type=submit> </form>]]></example> <example title="Receiving Script" result="1" condition="name"><![CDATA[Hi <?echo $name?>. You are <?echo $age?> years old.]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/simplexml1.xml?r=1.1&p=1 Index: presentations/slides/intro/simplexml1.xml +++ presentations/slides/intro/simplexml1.xml <slide title="Simple XML"> <blurb>No more SAX parsing and we get DTD validation and XPath queries</blurb> <example title="Book XML File"><![CDATA[<books> <book> <title>The Grapes of Wrath</title> <author>John Steinbeck</author> </book> <book> <title>The Pearl</title> <author>John Steinbeck</author> </book> </books>]]></example> <example title="Book PHP File"><![CDATA[<?php $books = simplexml_load_file('book.xml'); foreach ($books->book as $book) { echo "{$book->title} was written by {$book->author}<br>\n"; } ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/simplexml2.xml?r=1.1&p=1 Index: presentations/slides/intro/simplexml2.xml +++ presentations/slides/intro/simplexml2.xml <slide title="Simple RDF"> <blurb fontsize="3em">World's Easiest RDF parser?</blurb> <example fontsize="2em" result="0"><![CDATA[<?php $rdf = simplexml_load_file('rss_feed.rdf'); echo $rdf->channel->title; foreach ($rdf->channel->item as $item) { echo '<a href="'.$item->link.'">' . $item->title . '</a>'; } ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/sqlite1.php?r=1.1&p=1 Index: presentations/slides/intro/sqlite1.php +++ presentations/slides/intro/sqlite1.php <?php @exec('rm /tmp/lb.db'); $db = sqlite_open('/tmp/lb.db', 0666, $sqliteerror); if ($db) { sqlite_query($db, 'CREATE TABLE foo (bar varchar(10))'); sqlite_query($db, "INSERT INTO foo VALUES ('fnord')"); $result = sqlite_query($db,'select bar from foo'); $record = sqlite_fetch_array($result); var_dump($record); } else { die ($sqliteerror); } ?> http://cvs.php.net/co.php/presentations/slides/intro/sqlite1.xml?r=1.1&p=1 Index: presentations/slides/intro/sqlite1.xml +++ presentations/slides/intro/sqlite1.xml <slide title="SQLite"> <blurb>SQL Interface for flat files!</blurb> <example title="Example" fontsize="1.6em" result="1"><![CDATA[<?php @exec('rm /tmp/lb.db'); $db = sqlite_open('/tmp/lb.db', 0666, $sqliteerror); if ($db) { sqlite_query($db, 'CREATE TABLE foo (bar varchar(10))'); sqlite_query($db, "INSERT INTO foo VALUES ('fnord')"); $result = sqlite_query($db,'select bar from foo'); $record = sqlite_fetch_array($result); var_dump($record); } else { die ($sqliteerror); } ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/sqlite2.php?r=1.1&p=1 Index: presentations/slides/intro/sqlite2.php +++ presentations/slides/intro/sqlite2.php <?php $db = new sqlite_db(':memory:'); $db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))"); $db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)"); $r = $db->query("SELECT * from foo"); $result = $r->fetch_array(); ?> http://cvs.php.net/co.php/presentations/slides/intro/sqlite2.xml?r=1.1&p=1 Index: presentations/slides/intro/sqlite2.xml +++ presentations/slides/intro/sqlite2.xml <slide title="SQLite">> <blurb>Same thing with the OO interface</blurb> <example title="Example" fontsize="1.5em" type="php" result="0"><![CDATA[<?php $db = new sqlite_db(':memory:'); $db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))"); $db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)"); $r = $db->query("SELECT * from foo"); $result = $r->fetch_array(); ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/stack.xml?r=1.1&p=1 Index: presentations/slides/intro/stack.xml +++ presentations/slides/intro/stack.xml <slide title="Where is the money?"> <blurb title="Verticals!"> The money is where it has always been, _in the verticals_! </blurb> <list> <item>Customers care about the solution, not implementation details</item> <item>Vendor has more control and flexibility with Open Source horizontal components</item> <item>Vendor avoids paying per-seat licensing fees which directly improves the bottom-line</item> </list> <image filename="stack.png" /> <image filename="msstack.png" /> </slide> http://cvs.php.net/co.php/presentations/slides/intro/stop.xml?r=1.1&p=1 Index: presentations/slides/intro/stop.xml +++ presentations/slides/intro/stop.xml <slide title="Stop!"> <blurb> One of the most important aspects of performance tuning and even programming in general is knowing when to stop. Getting your web site or product into the hands of the customer is after all the goal of all this. If you sit around and fiddle with it for months, nobody is using it. </blurb> <image filename="dlt800x600.jpg" align="center" /> <blurb> Once you have located all the low-hanging fruit, further optimization tends to get exponentially harder for less and less gain. The time you spend on it compared to simply buying another server or two is usually not worth it. Stop and move onto the next project. </blurb> <blurb> Or better yet, go home, spend some time away from these beastly computers and spend some time with your wife and/or kids </blurb> </slide> http://cvs.php.net/co.php/presentations/slides/intro/streams.xml?r=1.1&p=1 Index: presentations/slides/intro/streams.xml +++ presentations/slides/intro/streams.xml <slide title="Streams and filters"> <break /> <example><![CDATA[<?php echo "<pre>"; print_r(stream_get_wrappers()); print_r(stream_get_filters()); echo "</pre>"; ?>]]></example> <example fontsize="1.8em"><![CDATA[Array ( [0] => php [1] => file [2] => http [3] => ftp [4] => compress.zlib ) Array ( [0] => string.rot13 [1] => string.toupper [2] => string.tolower [3] => string.strip_tags [4] => convert.* )]]></example> <example title="Examples" fontsize="1.4em"><![CDATA[<?php readfile("php://filter/read=string.toupper/resource=http://www.example.com"); $fp = fopen("compress.zlib://foo-bar.txt.gz", "wb"); $httpsfile = file_get_contents("https://www.example.com/foo.txt"); $sock = fsockopen("ssl://secure.example.com", 443, $errno, $errstr, 30); ?>]]></example> <example title="stream_copy_to_stream" fontsize="1.4em"><![CDATA[<?php $src = fopen('http://www.example.com','r'); $dest1 = fopen('first1k.txt','w'); $dest2 = fopen('remainder.txt','w'); stream_copy_to_stream($src, $dest1, 1024); stream_copy_to_stream($src, $dest2); ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/xdebug.xml?r=1.1&p=1 Index: presentations/slides/intro/xdebug.xml +++ presentations/slides/intro/xdebug.xml <slide title="xdebug"> <example title="Installing Xdebug" fontsize="1.3em" type="shell"><![CDATA[pear -v install http://files.derickrethans.nl/xdebug-1.3.0.tgz + create dir /usr/local/lib/php/docs/xdebug 52 source files, building building in /tmp/tmpH4fmdM/xdebug-1.3.0 running: phpize Configuring for: PHP Api Version: 20020918 Zend Module Api No: 20020429 Zend Extension Api No: 20021010 building in /var/tmp/pear-build-root/xdebug-1.3.0 running: /tmp/tmpH4fmdM/xdebug-1.3.0/configure checking build system type... i686-redhat-linux-gnu checking host system type... i686-redhat-linux-gnu checking for gcc... gcc checking for C compiler default output... a.out ... Build process completed successfully Installing 'xdebug.so' at ext_dir (/usr/local/lib/php/extensions/no-debug-non-zts-20020429/xdebug.so) about to commit 16 file operations successfully committed 16 file operations install ok: xdebug 1.3.0]]></example> <example title="Stack trace" result="1"><![CDATA[<?php xdebug_start_trace(); function a() { b(); } function b() { xdebug_dump_function_trace(); } a(); ?>]]></example> <example title="Modified error handler" result="1"><![CDATA[<?php echo $a[1]; ?>]]></example> <example title="Modified var_dump()" result="1"><![CDATA[<?php var_dump($_COOKIE); ?>]]></example> </slide> http://cvs.php.net/co.php/presentations/slides/intro/yahoo-numbers.xml?r=1.1&p=1 Index: presentations/slides/intro/yahoo-numbers.xml +++ presentations/slides/intro/yahoo-numbers.xml <slide title="Yahoo! is Big!"> <list> <title>March 2003 Numbers</title> <bullet>232 million visitors per month</bullet> <bullet>112 million active registered users</bullet> <bullet>2.9 million fee paying customers</bullet> <bullet>1.9 billion average daily page requests</bullet> </list> <image marginleft="4em" clear="left" filename="top25.png" title="Top 25 Global Web Destinations"/> <blurb>Source: Nielsen//NetRatings</blurb> </slide>