<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>Derick Rethans - tag: xdebug</title>
    <link>http://derickrethans.nl/feed-xdebug.xml</link>
    <description>This feed shows the latest 15 items with the tag xdebug</description>
    <language>en-us</language>
    <copyright>All rights reserved - Derick Rethans</copyright>
    <managingEditor>derick@derickrethans.nl (Derick Rethans)</managingEditor>
    <pubDate>Thu, 18 Mar 2010 23:24:04 +0000</pubDate>
    <lastBuildDate>Thu, 18 Mar 2010 23:24:04 +0000</lastBuildDate>
    <generator>eZ Components Feed dev (http://ezcomponents.org/docs/tutorials/Feed)</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>60</ttl>
    <item>
      <title>Available for PHP Extension Writing</title>
      <link>http://derickrethans.nl/available-for-php-extension-writing.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="available_for_php_extension_writing"/&gt;Available for PHP Extension Writing&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Monday, March 15th 2010, 12:28 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Slightly more than a month ago I left my job as team-lead of &lt;a href="http://ezcomponents.org"&gt;eZ Components&lt;/a&gt; at &lt;a href="http://ez.no"&gt;eZ Systems&lt;/a&gt; behind, to focus on something new. During the past month I've been contemplating about what to do next and realized that I do not want to take on a new full-time position right away.  Instead I will be available to work on (custom) PHP extensions and internals related issues. Extensions are a great way around PHP's limitations and performance issues.&lt;/p&gt;
      &lt;p&gt;As first project I am working on a "&lt;a href="http://svn.xdebug.org/quickhash/trunk"&gt;QuickHash&lt;/a&gt;" extension for &lt;a href="http://www.stumbleupon.com/"&gt;StumbleUpon&lt;/a&gt;. This extension circumvents PHP's hefty memory (and performance) overhead by providing more specific data structures. The extension currently implements integer sets and integer to integer hashes. I am now adding integer to string hashes and string to integer hashes. The QuickHash extension will be released under the PHP Licence and I will dedicate another post to it later.&lt;/p&gt;
      &lt;p&gt;If, like &lt;a href="http://www.stumbleupon.com/"&gt;StumbleUpon&lt;/a&gt;, you are also interested in having work done on PHP or a specific extensions feel free to &lt;a href="/who.html"&gt;contact&lt;/a&gt; me. I'd be happy to discuss things with you.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201003151228</guid>
      <pubDate>Mon, 15 Mar 2010 12:28:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug 2.1.0beta3 released</title>
      <link>http://derickrethans.nl/xdebug-210beta3.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_2_1_0beta3_released"/&gt;Xdebug 2.1.0beta3 released&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; Europe/London&lt;/div&gt;
        &lt;div class="date"&gt;Saturday, February 27th 2010, 23:57 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;I've just released Xdebug 2.1.0beta3 which includes a few crash bugs as well as the issue that headers sent from PHP scripts are not actually set.&lt;/p&gt;
      &lt;p&gt;You can find the full changelog &lt;a href="http://xdebug.org/updates.php#x_2_1_0beta3"&gt;here&lt;/a&gt; and get the latest version from the &lt;a href="http://xdebug.org/download.php"&gt;download page&lt;/a&gt;.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201002272352</guid>
      <pubDate>Sat, 27 Feb 2010 23:57:00 +0000</pubDate>
    </item>
    <item>
      <title>More source analysis with VLD</title>
      <link>http://derickrethans.nl/more-source-analysis-with-vld.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="more_source_analysis_with_vld"/&gt;More source analysis with VLD&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Friday, February 19th 2010, 11:27 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;&lt;a href="http://derickrethans.nl/projects.html#vld"&gt;VLD&lt;/a&gt; is a tool that I started working on years ago to visualise the opcode arrays in PHP. Opcode arrays are what PHP's compiler generates from your source code and can be compared to assembler code that is generated by a C compiler. Instead of it being directly executed by the CPU, it is instead executed by PHP's interpreter.&lt;/p&gt;
      &lt;p&gt;Over the years I've been adding some functionality, also aided by &lt;a href="http://ilia.ws"&gt;Ilia&lt;/a&gt; and some others, to show more information. For example Ilia has added a more verbose dumping format for opcodes (through the &lt;code&gt;vld.verbosity&lt;/code&gt; setting) whereas I have added routines to find out which ops in oparrays can never be reached. A very simple example of the latter is shown here:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
function test()
{
        echo "Hello!\n";
        return true;

        echo "This will not be executed.\n";
}
?&gt;

&lt;/pre&gt;
      &lt;p&gt;If we run the above through VLD with &lt;code&gt;php -dvld.active=1 test.php&lt;/code&gt;, you'll see the following output (I removed the part about the script body itself):&lt;/p&gt;
      &lt;pre&gt;Function test:
filename:       /tmp/test1.php
function name:  test
number of ops:  9
compiled vars:  none
line     # *  op           fetch  ext  return  operands
---------------------------------------------------------
   2     0  &gt;   EXT_NOP
   4     1      EXT_STMT
         2      ECHO                           'Hello%21%0A'
   5     3      EXT_STMT
         4    &gt; RETURN                         true
   7     5*     EXT_STMT
         6*     ECHO                           'This+will+not+be+executed.%0A'
   8     7*     EXT_STMT
         8*   &gt; RETURN                         null

End of function test.

&lt;/pre&gt;
      &lt;p&gt;Every opcode that has a &lt;code&gt;*&lt;/code&gt; after the number (like in &lt;code&gt;5*&lt;/code&gt;) is code that can not be reached, and can possibly be eliminated from the oparrays in an optimiser.&lt;/p&gt;
      &lt;p&gt;The dead code analysis routines have also made their way into &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; which uses them for the &lt;a href="http://xdebug.org/docs/code_coverage"&gt;code coverage&lt;/a&gt; functionality to highlight dead code. This mostly makes sense if you are running your code coverage together with unit tests such as you can do with &lt;a href="http://www.phpunit.de"&gt;PHPUnit&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;Recently I've been working on some new functionality to visualise all the code &lt;em&gt;paths&lt;/em&gt; that make up each function. These new routines sit on top of the routines that do dead code analysis. Every branch instruction (such as &lt;code&gt;if&lt;/code&gt;, but also &lt;code&gt;for&lt;/code&gt; and &lt;code&gt;foreach&lt;/code&gt;) is analysed and a list of branches is created. Each branch contains information about the line on which the branch starts, the starting and ending opcode numbers that belong to the branch, as well as to which other branches this branch can jump to. There can be either no linked branches (when for example a &lt;code&gt;return&lt;/code&gt; or &lt;code&gt;throw&lt;/code&gt; statement is found), one linked branch (for an unconditional jump) or two linked branches (on a branch instruction).  However, you need to be aware that internally, PHP's opcode don't always reflect the &lt;em&gt;source code&lt;/em&gt; exactly.&lt;/p&gt;
      &lt;p&gt;Once all the branches and their links are found, another algorithm runs to figure out which paths can be created out of all the branches. It is best to illustrate this with an example. So let us look at the following script:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
function test()
{
        for( $i = 0; $i &lt; 10; $i++ )
        {
                if ( $i &lt; 5 )
                {
                        echo "-";
                }
                else
                {
                        echo "+";
                }
        }
        echo "\n";
}
?&gt;

&lt;/pre&gt;
      &lt;p&gt;In this script we have a &lt;code&gt;for&lt;/code&gt;-loop with a nested &lt;code&gt;if&lt;/code&gt; construct. When we run this script through VLD (with &lt;code&gt;php -dvld.verbosity=0 -dvld.dump_paths=1
-dvld.active=1 test2.php&lt;/code&gt;) we get the following output (again, only the &lt;code&gt;test()&lt;/code&gt; function and with some white space modifications):&lt;/p&gt;
      &lt;pre&gt;Function test:
filename:       /tmp/test2.php
function name:  test
number of ops:  22
compiled vars:  !0 = $i
line     # *  op             fetch  ext  return  operands
-----------------------------------------------------------
   2     0  &gt;   EXT_NOP
   4     1      EXT_STMT
         2      ASSIGN                             !0, 0
         3  &gt;   IS_SMALLER                 ~1      !0, 10
         4      EXT_STMT
         5    &gt; JMPZNZ                  9          ~1, -&gt;18
         6  &gt;   POST_INC                   ~2      !0
         7      FREE                               ~2
         8    &gt; JMP                                -&gt;3
   6     9  &gt;   EXT_STMT
        10      IS_SMALLER                 ~3      !0, 5
   7    11    &gt; JMPZ                               ~3, -&gt;15
   8    12  &gt;   EXT_STMT
        13      ECHO                               '-'
   9    14    &gt; JMP                                -&gt;17
  12    15  &gt;   EXT_STMT
        16      ECHO                               '%2B'
  14    17  &gt; &gt; JMP                                -&gt;6
  15    18  &gt;   EXT_STMT
        19      ECHO                               '%0A'
  16    20      EXT_STMT
        21    &gt; RETURN                             null

branch: #  0; line:  2- 4; sop:  0; eop:  2; out1:   3
branch: #  3; line:  4- 4; sop:  3; eop:  5; out1:  18; out2:   9
branch: #  6; line:  4- 4; sop:  6; eop:  8; out1:   3
branch: #  9; line:  6- 7; sop:  9; eop: 11; out1:  12; out2:  15
branch: # 12; line:  8- 9; sop: 12; eop: 14; out1:  17
branch: # 15; line: 12-14; sop: 15; eop: 16; out1:  17
branch: # 17; line: 14-14; sop: 17; eop: 17; out1:   6
branch: # 18; line: 15-16; sop: 18; eop: 21
path #1: 0, 3, 18,
path #2: 0, 3, 9, 12, 17, 6, 3, 18,
path #3: 0, 3, 9, 15, 17, 6, 3, 18,
End of function test.

&lt;/pre&gt;
      &lt;p&gt;This dump consists of a few different parts. First of all we can see some basic information containing the name, the number of ops (22) and the compiled variables. The second part is a dump of all the opcodes that make up this function. The last part contains information about all the branches and the possible paths.  This information is a bit hard to visualize in its textual form, so I've also added some code that dumps this information to a file format that the &lt;a href="http://graphviz.org/"&gt;GraphViz&lt;/a&gt; tool "dot" can use to create a pretty graph. For this we re-run the previous PHP invocation as &lt;code&gt;php -dvld.dump_paths=1
-dvld.verbosity=0 -dvld.save_paths=1 -dvld.active=1 test2.php&lt;/code&gt;. This creates the file &lt;code&gt;/tmp/paths.dot&lt;/code&gt; that "dot" can use. If we run &lt;code&gt;dot -Tpng
/tmp/paths.dot &gt; /tmp/paths.png&lt;/code&gt; we end up with the following picture:&lt;/p&gt;
      &lt;img src="/images/vld-paths.png" alt="vld-paths.png"/&gt;
      &lt;p&gt;If we put this graph next to the code, we can explain how this works. Every branch is named by the number of the first opcode in that branch:&lt;/p&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #1&lt;/code&gt; is the assignment of &lt;code&gt;$i&lt;/code&gt; in line 4.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #3&lt;/code&gt; is the &lt;em&gt;loop test&lt;/em&gt; in line 4. If the condition doesn't match, we jump to &lt;code&gt;op #18&lt;/code&gt; on line 16 that echos the newline.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #9&lt;/code&gt; is the &lt;code&gt;if&lt;/code&gt; condition on line 6.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #12&lt;/code&gt; is when the &lt;code&gt;if&lt;/code&gt; condition returns true and&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #15&lt;/code&gt; is when the &lt;code&gt;if&lt;/code&gt; condition returns false.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #17&lt;/code&gt; sits behind both &lt;code&gt;op #12&lt;/code&gt; and &lt;code&gt;op #15&lt;/code&gt; and makes sure there is a jump to the counting expression in &lt;code&gt;#op 6&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #6&lt;/code&gt; is the post increment operation on line 4 which will then again be followed by &lt;code&gt;op #3&lt;/code&gt; to check whether the end of the loop has been reached.&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;This is of course a very simple example, but it also works for (multiple) classes and functions in a file. You just need to make sure to tell VLD that you don't want the code &lt;em&gt;executed&lt;/em&gt; as the output could be very large. You can use the &lt;code&gt;vld.execute=0&lt;/code&gt; php.ini setting for that.&lt;/p&gt;
      &lt;p&gt;I hope this new functionality can spread some light on how loops etc. work in PHP. In order to play with the code, you need to check-out VLD from my SVN with &lt;code&gt;svn co svn://svn.xdebug.org/svn/php/vld/trunk vld&lt;/code&gt;. You can also view the code on-line at &lt;a href="http://svn.xdebug.org/cgi-bin/viewvc.cgi/vld/trunk/?root%3Dphp"&gt;http://svn.xdebug.org/cgi-bin/viewvc.cgi/vld/trunk/?root=php&lt;/a&gt;. Look out for a new release coming soon!&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201002191145</guid>
      <pubDate>Fri, 19 Feb 2010 11:27:00 +0000</pubDate>
    </item>
    <item>
      <title></title>
      <link>http://derickrethans.nl/.html</link>
      <description></description>
      <guid></guid>
      <pubDate>Thu, 18 Mar 2010 23:24:04 +0000</pubDate>
    </item>
    <item>
      <title>New Xdebug browser extensions</title>
      <link>http://derickrethans.nl/new-xdebug-helper.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="new_xdebug_browser_extensions"/&gt;New Xdebug browser extensions&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Wednesday, February 17th 2010, 12:33 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Years ago I &lt;a href="http://derickrethans.nl/starting-xdebugs-debugger-with-firefox.html"&gt;wrote&lt;/a&gt; about a Firefox extension that allows you to start an &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; debugging session by clicking on an icon in Firefox' status bar. For some unexplained reason, this extension is no longer available through Firefox' addon-site. Although I have a copy at &lt;a href="http://xdebug.org/files/xdebug_helper-0.3.1-fx.xpi"&gt;http://xdebug.org/files/xdebug_helper-0.3.1-fx.xpi&lt;/a&gt; for archival purposes, there are now a few other browser extensions that do the same thing.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;easy Xdebug&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/58688"&gt;easy Xdebug&lt;/a&gt; is an extension that serves as a replacement for the now unavailable Xdebug helper extension. It's written by &lt;a href="https://addons.mozilla.org/en-US/firefox/user/5114063"&gt;Brecht Vanhaesebrouck&lt;/a&gt; of &lt;a href="http://www.elime.be/"&gt;eLime&lt;/a&gt;. The extension was originally tested with &lt;a href="http://netbeans.org/"&gt;Netbeans&lt;/a&gt; but it also seems to work fine with &lt;a href="http://www.activestate.com/komodo/"&gt;Komodo&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Xdebug enabler&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;&lt;a href="http://blog.remailed.net/2010/01/xdebug-enabler-v0-2/"&gt;Xdebug enabler&lt;/a&gt; is an extension for Google's Chrome browser. It &lt;em&gt;"allows you to enable and disable triggering Xdebug from with in Chrome. Useful if you are a web developer using an IDE that supports Xdebug like Eclipse with PDT."&lt;/em&gt; It's written by 'remailednet' and available through the &lt;a href="https://chrome.google.com/extensions/detail/eippbhbeglgcphcjmpjcjinjamabeoln"&gt;Google Chrome Extensions&lt;/a&gt; website.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;JavaScript 'enabler'&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;I also ran across a &lt;a href="http://highervisibilitywebsites.com/simple-cross-browser-xdebug-helper-session-starter-and-stopper-no-add-ons-needed"&gt;blog post&lt;/a&gt; by 'Caleb G' from &lt;a href="http://highervisibilitywebsites.com/"&gt;HigherVisibility&lt;/a&gt;. Instead of making an extension for a specific browser, he outlines two JavaScript bookmarklets that allow you to start and stop an &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; debugging session.&lt;/p&gt;
      &lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; The "Xdebug enabler" Chrome Extension seems to have some issues. There is now also an alternative Chrome Extension called &lt;strong&gt;Xdebug helper&lt;/strong&gt; that integrates quite a bit better. You can find it at its &lt;a href="https://chrome.google.com/extensions/detail/eadndfjplgieldjbigjakmdgkmoaaaoc"&gt;Google Chrome Extension&lt;/a&gt; page.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201002171233</guid>
      <pubDate>Wed, 17 Feb 2010 12:33:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug 2.1.0beta2 released</title>
      <link>http://derickrethans.nl/xdebug-210beta2.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_2_1_0beta2_released"/&gt;Xdebug 2.1.0beta2 released&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; Dieren, the Netherlands&lt;/div&gt;
        &lt;div class="date"&gt;Wednesday, February 3rd 2010, 18:51 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;I've just released Xdebug 2.1.0beta2 which features a few small bug fixes only. With this release the Windows 5.3/VC6 binaries also return.&lt;/p&gt;
      &lt;p&gt;One of the bug fixes is in a new feature that allows you to configure that the debugger should connect back to the IDE running on the machine that initiated the HTTP request. This feature, that originally was contributed by Lucas Nealan and Brian Shire of Facebook, allows more easy use of multiple IDEs (users) working on the same code base. In order to enable this, set &lt;a href="http://xdebug.org/docs/all_settings#remote_connect_back"&gt;xdebug.remote_connect_back&lt;/a&gt; to 1. See the documentation for more information.&lt;/p&gt;
      &lt;p&gt;Of course, this feature should only be enabled if &lt;em&gt;nobody&lt;/em&gt; besides authorized developers can access the machine on which the xdebug.remote_connect_back callback feature has been enabled. Instead of enabling this setting, you can also support multiple developers through the proxy functionality that the DBGp protocol supports. For more information on that, see &lt;a href="http://derickrethans.nl/debugging-with-multiple-users.html"&gt;Debugging with multiple users&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;You can find the full changelog &lt;a href="http://xdebug.org/updates.php#x_2_1_0beta1"&gt;here&lt;/a&gt; and get the latest version from the &lt;a href="http://xdebug.org/download.php"&gt;download page&lt;/a&gt;.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201002031832</guid>
      <pubDate>Wed, 03 Feb 2010 18:51:00 +0000</pubDate>
    </item>
    <item>
      <title>Speaking at conferences in spring 2010</title>
      <link>http://derickrethans.nl/speaking-at-conferences-in-spring-2010.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="speaking_at_conferences_in_spring_2010"/&gt;Speaking at conferences in spring 2010&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Tuesday, January 26th 2010, 14:22 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;In the next few months, I will be speaking at the following conferences:&lt;/p&gt;
      &lt;p&gt;&lt;a href="http://conference.phpbenelux.eu/"&gt;PHPBenelux Conference&lt;/a&gt; 2010 is the first annual conference by the PHPBenelux usergroup. It is organized in Antwerp on Saturday January 30th. I will be giving a keynote titled "The PHP Universe".&lt;/p&gt;
      &lt;p&gt;&lt;a href="http://phpconference.co.uk/"&gt;PHP UK Conference&lt;/a&gt; is &lt;a href="http://www.phplondon.org/wiki/Main_Page"&gt;PHP London's&lt;/a&gt; fifth annual conference and held on Friday February 26th at the &lt;a href="http://www.businessdesigncentre.co.uk/"&gt;Business Design Centre&lt;/a&gt;. I will be talking on PHP on the D-BUS.&lt;/p&gt;
      &lt;p&gt;&lt;a href="http://confoo.ca/en"&gt;ConFoo&lt;/a&gt; (formerly PHP Québec) is the first edition of the Confoo.ca Conference. From March 10th to 12th 2010, international experts in Java, .Net, PHP, Python and Ruby will present solutions for developers and project managers the Hilton Bonaventure Hotel, located in downtown Montréal. I will be talking on &lt;a href="http://confoo.ca/en/2010/session/advanced-date-time-handling-with-php"&gt;Advanced Date/Time handling with PHP&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;Hope to see you there!&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201001261422</guid>
      <pubDate>Tue, 26 Jan 2010 14:22:00 +0000</pubDate>
    </item>
    <item>
      <title>Obtaining the next month in PHP</title>
      <link>http://derickrethans.nl/obtaining-the-next-month-in-php.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="obtaining_the_next_month_in_php"/&gt;Obtaining the next month in PHP&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Friday, January 8th 2010, 09:13 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Over and over again PHP users complain that &lt;code&gt;next month&lt;/code&gt; in PHP's date-string parser doesn't go to the next month, but instead skips to the one after next month; like in the following example:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$d = new DateTime( '2010-01-31' );
$d-&gt;modify( 'next month' );
echo $d-&gt;format( 'F' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;The output of the little script will be &lt;code&gt;March&lt;/code&gt;. March obviously doesn't follow January as February is in between. However, the current behavior &lt;strong&gt;is&lt;/strong&gt; correct. The following happens internally:&lt;/p&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;next month&lt;/code&gt; increases the month number (originally 1) by one. This makes the date &lt;code&gt;2010-02-31&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;The second month (February) only has 28 days in 2010, so PHP auto-corrects this by just continuing to count days from February 1st. You then end up at March 3rd.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;The formatting strips off the year and day, resulting in the output &lt;code&gt;March&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;This can easily be seen when echoing the date with a full date format, which will output &lt;code&gt;March 3rd, 2010&lt;/code&gt;:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
echo $d-&gt;format( 'F jS, Y' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;To obtain the correct behavior, you can use some of PHP 5.3's new functionality that introduces the relative time stanza &lt;code&gt;first day of&lt;/code&gt;. This stanza can be used in combination with &lt;code&gt;next month&lt;/code&gt;, &lt;code&gt;fifth month&lt;/code&gt; or &lt;code&gt;+8 months&lt;/code&gt; to go to the &lt;strong&gt;first day&lt;/strong&gt; of the specified month. Instead of &lt;code&gt;next month&lt;/code&gt; from the previous example, we use &lt;code&gt;first day of next month&lt;/code&gt; here:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$d = new DateTime( '2010-01-08' );
$d-&gt;modify( 'first day of next month' );
echo $d-&gt;format( 'F' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;This script will correctly output &lt;code&gt;February&lt;/code&gt;. The following things happen when PHP processes this &lt;code&gt;first day of next month&lt;/code&gt; stanza:&lt;/p&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;next month&lt;/code&gt; increases the month number (originally 1) by one. This makes the date &lt;code&gt;2010-02-31&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;first day of&lt;/code&gt; sets the day number to 1, resulting in the date &lt;code&gt;2010-02-01&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;The formatting strips off the year and day, resulting in the output &lt;code&gt;February&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;Besides &lt;code&gt;first day of&lt;/code&gt;, there is an equivalent &lt;code&gt;last day of&lt;/code&gt; to go to the last day of a month. The following example demonstrates this:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$d = new DateTime( '2010-01-08' );
$d-&gt;modify( 'last day of next month' );
echo $d-&gt;format( 'F jS, Y' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;This outputs &lt;code&gt;February 28th, 2010&lt;/code&gt;. Internally the following happens:&lt;/p&gt;
      &lt;img src="/images/content/datebook-cover.jpg" class="right" alt="datebook-cover.jpg"/&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;next month&lt;/code&gt; increases the month number (originally 1) by one. This makes the date &lt;code&gt;2010-02-08&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;last day of&lt;/code&gt; increases the month number by one, and sets the day number to 0, resulting in the date &lt;code&gt;2010-03-00&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;PHP then auto-corrects the invalid day number 0 by removing one from the month and skipping to the last day of that month, resulting in &lt;code&gt;2010-02-28&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;I hope this clears up some of the behaviour of PHP's Date/Time handling. For more information on Date/Time Programming with PHP, please refer to my book "&lt;a href="http://tinyurl.com/phpdatebookuk"&gt;php|architect's Guide to Date and Time Programming&lt;/a&gt;" that is available through &lt;a href="http://tinyurl.com/phpdatebookuk"&gt;Amazon&lt;/a&gt;.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201001080913</guid>
      <pubDate>Fri, 08 Jan 2010 09:13:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug 2.1.0beta1 released</title>
      <link>http://derickrethans.nl/xdebug-210beta1.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_2_1_0beta1_released"/&gt;Xdebug 2.1.0beta1 released&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Sunday, January 3rd 2010, 02:08 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;It has been two years since I &lt;a href="http://derickrethans.nl/xdebug-2-released.html"&gt;released&lt;/a&gt; &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; 2.0.0. Since then  I've added many new features to Xdebug. For some of those new features you can find a little description below—I will write more about these, and other features later.&lt;/p&gt;
      &lt;p&gt;Besides the features, I also fixed a whole array of bugs and Xdebug 2.1.0 comes with PHP 5.3 support. From now on I will not be supporting any PHP versions less than PHP 5.1 anymore. But now on to the descriptions:&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Header Setting Interception&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;All functions that set HTTP headers such as with &lt;a href="http://php.net/header"&gt;header()&lt;/a&gt; and &lt;a href="http://php.net/setcookie"&gt;setcookie()&lt;/a&gt; are now intercepted by Xdebug. The intercepted headers are stored internally in an array that can be retrieved by calling the &lt;a href="http://xdebug.org/docs/all_functions#xdebug_get_headers"&gt;xdebug_get_headers()&lt;/a&gt; function. This is very useful in cases where you need to test certain functionality that sets headers somewhere deep in code. This function is also used in &lt;a href="http://ezcomponents.org"&gt;eZ Components'&lt;/a&gt; test suite to &lt;a href="http://svn.ez.no/svn/ezcomponents/trunk/MvcTools/tests/response_writers/http.php"&gt;test&lt;/a&gt; whether the correct HTTP headers are set in the &lt;a href="http://ezcomponents.org/s/MvcTools"&gt;MvcTools&lt;/a&gt; component.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Variable Assignment Tracing&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;Allows you to record changes to variables in scripts to &lt;a href="http://xdebug.org/docs/execution_trace"&gt;trace files&lt;/a&gt;. I've already written more about it in &lt;a href="http://derickrethans.nl/variable-tracing-with-xdebug.html"&gt;Variable tracing with Xdebug&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;"Scream" Support&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;The &lt;a href="http://pecl.php.net/scream"&gt;scream&lt;/a&gt; PECL extension disables the @ (shut-up) operator to actually see all notices, warnings and errors that PHP generates. The scream extension's functionality have been duplicated as Xdebug's xdebug.scream php.ini setting. Why disabling the @-operator is a good thing, I've already outlined in &lt;a href="http://derickrethans.nl/five-reasons-why-the-shutop-operator-should-be-avoided.html"&gt;Five reasons why the shut-op operator (@) should be avoided&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;What's Next?&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;There are still a few bugs left that need some attention, but this first beta should have most of them fixed. Please test the beta as much as you can and provide feedback in the &lt;a href="http://bugs.xdebug.org"&gt;issue tracker&lt;/a&gt;. After this initial beta it is like that one more more betas will follow before I prepare a release candidate. Xdebug 2.1.0beta1 can be obtained through the &lt;a href="http://xdebug.org/download.php"&gt;Xdebug website&lt;/a&gt; and a full changelog is also &lt;a href="http://xdebug.org/updates.php#x_2_1_0beta1"&gt;available&lt;/a&gt;. You can also &lt;a href="http://twitter.com/xdebug"&gt;follow Xdebug on twitter&lt;/a&gt; to be kept up-to-date with the latest developments.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201001030112</guid>
      <pubDate>Sun, 03 Jan 2010 02:08:00 +0000</pubDate>
    </item>
    <item>
      <title>PHP Development Environment 2.0</title>
      <link>http://derickrethans.nl/multiple-php-versions.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="php_development_environment_2_0"/&gt;PHP Development Environment 2.0&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Thursday, December 31st 2009, 02:26 UTC&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;When &lt;a href="http://derickrethans.nl/xdebug-moved-to-a-new-server.html"&gt;moving&lt;/a&gt; the &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; website and my own website to a new server I had to pick a web server to serve the pages through PHP. Up to then I was still using Apache 1.3 with zero intentions to ever upgrade to any later version. I'd heard a lot about &lt;a href="http://www.lighttpd.net/"&gt;lighttpd&lt;/a&gt; and decided to give that a try—yes, that meant something that I didn't really know to well was going to run in a production environment. Unlike Apache, with lighttpd PHP doesn't run as a module, but instead you run it out of process with something called FastCGI.&lt;/p&gt;
      &lt;p&gt;On my development machine I was also running Apache 1.3 with PHP as static module embedded. If I want to test something with a different PHP version, I would start a different Apache daemon. When I had a quick look the other day, I found that I had about 28 different binaries named &lt;code&gt;httpd-{Apache
version}-{PHP version}&lt;/code&gt; ranging from PHP 4.1.2 to 6.0dev. Some of those I hadn't used for years.&lt;/p&gt;
      &lt;p&gt;All my PHP installations were installed with the same prefix (&lt;code&gt;/usr/local&lt;/code&gt;), where the last built PHP version was available as &lt;code&gt;php&lt;/code&gt; and additional versions as &lt;code&gt;php-{version}&lt;/code&gt;. An annoyance with this is, is that I had to run &lt;code&gt;make install&lt;/code&gt; in one of the PHP source directories before I could compile extensions against a different PHP version than the &lt;em&gt;latest installed one&lt;/em&gt;. This combined with the enormous amount of httpds and the inability to run multiple versions of PHP at the same time prompted me to come up with something better: &lt;em&gt;PHP Development Environment 2.0&lt;/em&gt;.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Multiple PHP Installations&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;The first thing I wanted to do was to make sure that each minor PHP version (5.1.x, 5.2.x, 5.3.x and 6.0.x) could be installed alongside each other, and that I could compile extensions to all of them without having to re-run &lt;code&gt;make
install&lt;/code&gt;. I did this by specifying &lt;code&gt;--prefix=/usr/local/php/{PHP
version}&lt;/code&gt; to the PHP configure call. At the same time, I also removed the &lt;code&gt;--with-apache&lt;/code&gt; configure option and for PHP 5.1 and PHP 5.2 I added the &lt;code&gt;--enable-fastcgi&lt;/code&gt; option which is default enabled for PHP 5.3 and PHP 6.0. The initial section of the configure invocation now looks like for the PHP 5.2 build:&lt;/p&gt;
      &lt;pre&gt;./configure --prefix=/usr/local/php/5.2dev --enable-fastcgi \
  --with-gd  ...more configure options here...

&lt;/pre&gt;
      &lt;p&gt;Although &lt;code&gt;/usr/local/bin&lt;/code&gt; is usually in the path, but &lt;code&gt;/usr/local/php/5.2dev/bin&lt;/code&gt; is definitely not. The initial goal was to be able to easily switch between different PHP versions, so I added a snippet to my &lt;code&gt;.bashrc&lt;/code&gt; that sets the correct &lt;code&gt;PATH&lt;/code&gt; environment variable depending on the selected PHP version:&lt;/p&gt;
      &lt;pre&gt;function pe () {
  version=$1
  shift

  if [ "$#" == "0" ]; then
    export PATH=/usr/local/php/${version}/bin:/usr/local/bin:/usr/bin:/bin
  else
    PATH=/usr/local/php/${version}/bin:$PATH $@
  fi
}

&lt;/pre&gt;
      &lt;p&gt;This bash function is then evoked like &lt;code&gt;pe 5.3dev&lt;/code&gt; to set the path in such a way that &lt;code&gt;php&lt;/code&gt; runs the PHP 5.3 binary, as well as additional tools such as &lt;code&gt;pear&lt;/code&gt;, &lt;code&gt;phpize&lt;/code&gt; (required to build extensions) and &lt;code&gt;php-config&lt;/code&gt;. If you forget to call the &lt;code&gt;pe&lt;/code&gt; function, then when running &lt;code&gt;php&lt;/code&gt; you will encounter the warning &lt;code&gt;bash: php: command not found&lt;/code&gt;. You could pick a default version if you wanted, but I prefer that I always have to be explicit about which PHP version I pick. Multiple install paths makes it easier to maintain multiple PHP installs, but it also means that you have to install tools such as &lt;a href="http://www.phpunit.de/"&gt;PHP Unit&lt;/a&gt; for each of the installations.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Setting up Lighttpd&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;Now that I had multiple PHP installations, I could move on to setting up lighttpd. As I have mentioned, I never used lighttpd before and decided to take the easy way by installing it with &lt;code&gt;apt-get install lighttpd&lt;/code&gt;. PHP works through the FastCGI interface with lighttpd which you can enable with &lt;code&gt;lighttpd-enable-mod cgi fastcgi simple-vhost&lt;/code&gt; (I also enabled CGI and simple VHOSTing).&lt;/p&gt;
      &lt;p&gt;To enable PHP as FastCGI server, and to be able to run multiple versions at the same time, I modified the &lt;code&gt;/etc/lighttpd/conf-enabled/10-fastcgi.conf&lt;/code&gt; configuration file. Find my annotated version below:&lt;/p&gt;
      &lt;pre&gt;## Enable the FastCGI module.
server.modules   += ( "mod_fastcgi" )

&lt;/pre&gt;
      &lt;p&gt;Next we start an FastCGI server for the default PHP version (5.3) on the default port (80) by enabling it in the global scope:&lt;/p&gt;
      &lt;pre&gt;fastcgi.server    = ( ".php" =&gt;
  ((
    ## The path to the PHP-CGI executable
    "bin-path" =&gt; "/usr/local/php/5.3dev/bin/php-cgi",

    ## The listening socket that allows lighttpd to talk
    ## to the PHP FastCGI process. This needs to be
    ## different for each fastcgi.server definition.
    "socket" =&gt; "/tmp/php80.socket",

    ## Configure the number of parent processes that are
    ## spawned by lighttpd (max-procs) and configure how
    ## many many workers should be started (4) and the
    ## maximum number of requests that they can process
    ## before they get recycled (10000).
    "max-procs" =&gt; 1,
    "bin-environment" =&gt; (
      "PHP_FCGI_CHILDREN" =&gt; "4",
      "PHP_FCGI_MAX_REQUESTS" =&gt; "10000"
    ),

    ## configure additional bits
    "bin-copy-environment" =&gt; (
      "PATH", "SHELL", "USER"
    ),
    "broken-scriptfilename" =&gt; "enable"
    "idle-timeout" =&gt; 20,
  ))
)

&lt;/pre&gt;
      &lt;p&gt;Now tell lighttpd to also listen on port 8502. And in case requests come in over this port, use the defined FastCGI server for *.php. In this case we configure PHP 5.2. Similarily you can also define a block for PHP 5.1 (on a suggested port 8501) and PHP 6.0:&lt;/p&gt;
      &lt;pre&gt;$SERVER["socket"] == ":8502" {
  fastcgi.server    = ( ".php" =&gt;
    ((
      "bin-path" =&gt; "/usr/local/php/5.2dev/bin/php-cgi",
      "socket" =&gt; "/tmp/php8052.socket",
      "max-procs" =&gt; 1,
      "idle-timeout" =&gt; 20,
      "bin-environment" =&gt; (
        "PHP_FCGI_CHILDREN" =&gt; "4",
        "PHP_FCGI_MAX_REQUESTS" =&gt; "10000"
      ),
      "bin-copy-environment" =&gt; (
        "PATH", "SHELL", "USER"
      ),
      "broken-scriptfilename" =&gt; "enable"
    ))
  )
}

&lt;/pre&gt;
      &lt;p&gt;Tell lighttpd to also listen on port 8502. Because we're not overriding the fastcgi.server configuration from the global configuration (the bit were we set-up PHP 5.3 in the first few lines of the file), it will reuse this fastcgi.server configuration enabling requests for .php files coming in on port 80 or 8503 to be processed by the globally configured FastCGI server:&lt;/p&gt;
      &lt;pre&gt;$SERVER["socket"] == ":8503" {
# Just some dummy text because lighttpd doesn't allow
# empty definitions.
}

&lt;/pre&gt;
      &lt;p&gt;With the configuration made, you only have to restart lighttpd with &lt;code&gt;/etc/init.d/lighttpd force-reload&lt;/code&gt; and PHP is ready to go on multiple ports with different PHP versions.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200912301652</guid>
      <pubDate>Thu, 31 Dec 2009 02:26:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug moved to a new server</title>
      <link>http://derickrethans.nl/xdebug-moved-to-a-new-server.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_moved_to_a_new_server"/&gt;Xdebug moved to a new server&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Friday, November 27th 2009, 14:42 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;&lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; 's CVS server was previously hosted at &lt;a href="http://ez.no"&gt;eZ Systems&lt;/a&gt;' office, but as I am leaving soon I needed to move this to a different server. At the same time, I decided to also convert from CVS to SVN. So from now on, there is no more cvs.xdebug.org, but just a &lt;a href="http://svn.xdebug.org"&gt;svn.xdebug.org&lt;/a&gt;. This SVN server doesn't only host Xdebug, but also some of my other projects, such as &lt;a href="http://svn.xdebug.org/cgi-bin/viewvc.cgi/vld/?root%3Dphp"&gt;VLD&lt;/a&gt; (opcode dumper to aid PHP engine development), the &lt;a href="http://svn.xdebug.org/cgi-bin/viewvc.cgi/?root%3Dxdebug"&gt;DBGp&lt;/a&gt; specs (debugger protocol as used by Xdebug and &lt;a href="http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging"&gt;ActiveState's debuggers&lt;/a&gt;) and my OpenMoko &lt;a href="http://svn.xdebug.org/cgi-bin/viewvc.cgi/?root%3Dopenmoko"&gt;perversions and projects&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;Xdebug can now be checked out from SVN with:&lt;/p&gt;
      &lt;pre&gt;svn co svn://svn.xdebug.org/svn/xdebug/xdebug/trunk xdebug

&lt;/pre&gt;
      &lt;p&gt;All other Xdebug services (&lt;a href="http://xdebug.org/support.php#list"&gt;mailinglists&lt;/a&gt;, web, e-mail and the &lt;a href="http://bugs.xdebug.org"&gt;bug system&lt;/a&gt;) moved to the same server as well. Just be aware that DNS servers might still need updating when you try to access the new services.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200911271442</guid>
      <pubDate>Fri, 27 Nov 2009 14:42:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug and tracing memory usage</title>
      <link>http://derickrethans.nl/xdebug-and-tracing-memory-usage.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_and_tracing_memory_usage"/&gt;Xdebug and tracing memory usage&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Friday, November 13th 2009, 11:59 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Recently people started to ask me how to use &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; to figure out which parts of applications use a lot of memory. Traditionally this was part of Xdebug's &lt;a href="http://xdebug.org/docs/profiler"&gt;profiling&lt;/a&gt; functionality. Unfortunately the cachegrind format didn't fit this so well, and because it returned incorrect data I removed this functionality from the profiler. However, there is other functionality in Xdebug that does provide the correct data: the &lt;a href="http://xdebug.org/docs/execution_trace"&gt;function traces&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;Function traces log every include, function call and method call to a file. If the &lt;a href="http://xdebug.org/docs/execution_trace#trace_format"&gt;xdebug.trace_format&lt;/a&gt; setting is set to "1" then the trace file is an easy-to-parse tab separated format. The information that is logged includes the time-index when the function started and ended, and it also contains the amount of memory that was in use when entering the function, as well as when leaving it. With the last two numbers it's rather trivial to write a script to figure out which functions/methods increase the memory usage a lot. Of course, nobody had written a script yet to do anything with this information&lt;/p&gt;
      &lt;p&gt;As part of my preparations for my Xdebug talk at &lt;a href="http://phpconference.com"&gt;IPC&lt;/a&gt; next week, I now have written such a script. The script parses the tab-separated function trace files and aggregates all the information by function name. You can sort the output on a few different keys: time-own, memory-own, time-inclusive, memory-inclusive and calls. You can also configure how many elements it will show. As an example here is some output from a trace of one of the presentation system's PHP scripts:&lt;/p&gt;
      &lt;pre&gt;$ php tracefile-analyser.php trace.2043925204.xt memory-own 20

&lt;/pre&gt;
      &lt;pre&gt;parsing...
Done.
Showing the 20 most costly calls sorted by 'memory-own'.
                                               Inclusive        Own
function                               #calls  time     memory  time     memory
-------------------------------------------------------------------------------
require_once                                9  0.0541  4595160  0.0277  2548104
{main}                                      1  0.0600  2906032  0.0034   249744
fread                                       4  0.0001    33296  0.0001    33296
session_start                               1  0.0002    31824  0.0002    31824
XML_Presentation-&gt;startHandler             38  0.0073    36360  0.0035    18424
_pres_slide-&gt;_pres_slide                   27  0.0009    10152  0.0009    10152
_presentation-&gt;_presentation                1  0.0001     7912  0.0001     7912
strtolower                                 67  0.0017     6456  0.0017     6456
compact                                     1  0.0000     4832  0.0000     4832
each                                        5  0.0001     4320  0.0001     4320
XML_Presentation-&gt;endHandler               38  0.0014     3800  0.0014     3960
_slide-&gt;_slide                              1  0.0001     3896  0.0001     3896
XML_Slide-&gt;startHandler                     4  0.0009    10800  0.0004     3736
_image-&gt;_image                              1  0.0000     3040  0.0000     3040
fopen                                       2  0.0001     2816  0.0001     2816
getimagesize                                1  0.0001     2296  0.0001     2296
display-&gt;display                            1  0.0001     2120  0.0001     2120
explode                                     2  0.0001     2120  0.0001     2120
xml_parser_create                           2  0.0001     1680  0.0001     1680
XML_Parser-&gt;_initHandlers                   2  0.0011     1600  0.0005     1360

&lt;/pre&gt;
      &lt;p&gt;The script is available from SVN by running:&lt;/p&gt;
      &lt;pre&gt;svn co svn://svn.xdebug.org:/svn/xdebug/xdebug/trunk/contrib xdebug/contrib

&lt;/pre&gt;
      &lt;p&gt;The script to run is then "tracefile-analyser.php" from inside the "xdebug/contrib" directory.&lt;/p&gt;
      &lt;p&gt;&lt;strong&gt;Update 2009-12-28&lt;/strong&gt;: Changed the CVS instructions to the new SVN instructions.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200911131159</guid>
      <pubDate>Fri, 13 Nov 2009 11:59:00 +0000</pubDate>
    </item>
    <item>
      <title>CodeWorks and ZendCon</title>
      <link>http://derickrethans.nl/codeworks-and-zendcon.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="codeworks_and_zendcon"/&gt;CodeWorks and ZendCon&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Monday, October 19th 2009, 05:46 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;&lt;a href="http://cw.mtacon.com/"&gt;CodeWorks&lt;/a&gt; was a blast, I recorded a few talks that I will be publishing through &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;. As teaser I have a recording of Scott MacVicar's &lt;a href="http://vimeo.com/7065312"&gt;PECL picks&lt;/a&gt; talk. I also have recordings of Brian Moon's Memcached talk, Chris Shiflett's Security-Centered Design talk and Sharon Levy's Web-Based Retrieval Demystified talk. With all the other random video material I am creating a compilation as well, but that will have to wait a bit more.&lt;/p&gt;
      &lt;p&gt;At the moment I am on my way to San Jose where I will speak on &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; and PHP's &lt;a href="http://phpdatebook.com"&gt;DateTime support&lt;/a&gt;. Xdebug 2.1 is now feature complete, and I will be working on getting all the open bugs resolved. A release before the end of the year seems likely.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200910190546</guid>
      <pubDate>Mon, 19 Oct 2009 04:46:00 +0000</pubDate>
    </item>
    <item>
      <title>Autumn Plans</title>
      <link>http://derickrethans.nl/autumn-plans.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="autumn_plans"/&gt;Autumn Plans&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Monday, September 14th 2009, 13:26 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;I've been missing-in-action on my own blog for some time. Moving to London does that to you. Anyway, I've not been idle in the meanwhile at all, and been working on some cool side-projects. First of all I've been adding some features to &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; . Xdebug is now slow reaching beta-status for the 2.1 release. New feature will include proper PHP 5.3 support, variable tracing, "scream" support and other minor features.&lt;/p&gt;
      &lt;p&gt;Besides Xdebug I've also been hacking on PHP-GTK applications for my &lt;a href="http://wiki.openmoko.org/wiki/Main_Page"&gt;phone&lt;/a&gt; . The major new thing that I have now is a PHP-GTK twitter client that works like I want it... and I even use it on my desktop instead of all the other stuff that's out there. I will soon be publishing this client in my CVS repository.&lt;/p&gt;
      &lt;p&gt;Now that the conference season is starting again I'm working on improving several talks, as well as rewriting some parts for them. The first conference that I will be speaking at, are part of &lt;a href="http://mtabini.blogspot.com/"&gt;"Marco's Crazy PHP Conference Tour"&lt;/a&gt; aka &lt;a href="http://cw.mtacon.com"&gt;CodeWorks&lt;/a&gt; . I'll be giving three different talks here, one on "Debugging with &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; ", one on PHP's &lt;a href="http://phpdatebook.com"&gt;DateTime support&lt;/a&gt; and one on "Improving your development process" where I'll be talking about Test-Driven Development and other tricks associated by running a project. As CodeWorks is a bit like a rock-star tour, I'll be keeping a video blog of it somewhere on the intertubes.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200909141326</guid>
      <pubDate>Mon, 14 Sep 2009 12:26:00 +0000</pubDate>
    </item>
    <item>
      <title>pfcongrez, P2P Конференция, php|tek, PHP Vikinger, DPC and eZ Conference and Awards</title>
      <link>http://derickrethans.nl/pfcongrez-p2p-konferenciya-phptek-php-vikinger-dpc-and-ez-conference-and-awards.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="pfcongrez_p2p_php_tek_php_vikinger_dpc_and_ez_conference_and_awards"/&gt;pfcongrez, P2P Конференция, php|tek, PHP Vikinger, DPC and eZ Conference and Awards&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Friday, April 10th 2009, 01:45 CEST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;The above mentioned conferences all have one thing in common: I'll be speaking. At the first conference, &lt;a href="http://pfcongrez.nl/"&gt;pfcongrez&lt;/a&gt; I will be talking on implementing Test Driven Development as a model for software development. A modified version of this talk I will also give at the next conference, &lt;a href="http://wtconferences.com"&gt;P2P Конференция&lt;/a&gt; (P2P Conference) in Bulgaria. At this same conference I will be talking on using PHP as development language for GSM based applications on mobile computing platforms running Linux, where I will use the &lt;a href="http://pecl.php.net/dbus"&gt;pecl/dbus&lt;/a&gt; extension to talk to the interface framework available on the &lt;a href="http://openmoko.com"&gt;OpenMoko&lt;/a&gt; platform. This same talk I will also give at &lt;a href="http://phpconference.nl"&gt;DPC&lt;/a&gt; in Amsterdam. In between however I will go to Chicago to speak at &lt;a href="http://tek.mtacon.com"&gt;php|tek&lt;/a&gt; on search technologies in my "Haystacks and Needles" talk and on simple architecture in my KISS talk. Before DPC I will also go to Leuven for &lt;a href="http://phpvikinger.org"&gt;PHP Vikinger&lt;/a&gt; , an unconference that I'll be organizing for the 3rd time. This year it is no longer in Norway, but instead we moved to Leuven in Belgium. It is also de-coupled from the &lt;a href="http://ez.no/company/ez_conference_awards"&gt;eZ Conference and Awards&lt;/a&gt; which will be in Paris.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200904100145</guid>
      <pubDate>Thu, 09 Apr 2009 23:45:00 +0000</pubDate>
    </item>
  </channel>
</rss>
