<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Garrett Serack: Open Source Development at Microsoft : PHP</title><link>http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx</link><description>Tags: PHP</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Building an Optimized PHP Build process on Windows (Part IV)</title><link>http://blogs.msdn.com/garretts/archive/2009/06/23/building-an-optimized-php-build-process-on-windows-part-iv.aspx</link><pubDate>Wed, 24 Jun 2009 05:16:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9800643</guid><dc:creator>GarrettS</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/garretts/comments/9800643.aspx</comments><wfw:commentRss>http://blogs.msdn.com/garretts/commentrss.aspx?PostID=9800643</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;Previously, I had discussed what it took to use PGO on the Windows PHP build. The lead to me building automated build scripts…&lt;/em&gt;&lt;/p&gt;  &lt;h5&gt;&lt;u&gt;Automation as the root of all evil &lt;/u&gt;&lt;/h5&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&amp;quot;Anything that can be done for you, automatically, can be done to you, automatically.&amp;quot; – David C. Wyland&lt;/em&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;First, I had to get the entire dependency stack into the mix.&amp;#160; While some of the dependent libraries had VCProject files, some didn't.&amp;#160; Worse, even if they had them, you couldn't tell with a degree of certainty that they were compiled with the same settings which would enable them to take advantage of PGO optimization.&amp;#160; I began taking each project, updating (or creating, using the &lt;a href="http://gstoolkit.codeplex.com/Wiki/View.aspx?title=Trace"&gt;Trace&lt;/a&gt; and &lt;a href="http://gstoolkit.codeplex.com/Wiki/View.aspx?title=mkProject"&gt;mkProject&lt;/a&gt; tools) the Visual C++ project files that would use the same settings as the rest, and eventually came up with a solution file that had 74 projects in it (some of the projects generated more than one binary). &lt;/p&gt;  &lt;p&gt;Next, I had to actually automate the process of creating the vcproject files. Once you've got the right dependencies, the PHP build process cranks out over 30 binaries when you include the PHP extensions that get built as part of the core.&amp;#160; After what seemed like a million compile-verify-tweak iterations, I had the tools that could generate VCProject files for the core PHP and all the extensions, provided it was all in the right place. &lt;/p&gt;  &lt;p&gt;Next I wrote a .cmd batch script that went step-by-step, checking out the source, compiling the dependent libraries, building the PHP makefile, compiling PHP like the community did—and logging what it was doing, then switching to instrumentation, rebuilding the dependencies again, building the stack, PGO training it with test data and some applications (Wordpress, MediaWiki and phpBB) and then relinking it with optimization. &lt;/p&gt;  &lt;p&gt;I got the .cmd script almost working, but it was fairly fragile.&amp;#160; At that point I &lt;a href="http://fearthecowboy.com/post/Choosing-a-batch-scripting-language-on-Windows.aspx"&gt;decided to switch batch scripting strategies&lt;/a&gt;, and in about a week, rewrote the batch script in &lt;a href="http://fearthecowboy.com/?tag=/jscript"&gt;JScript&lt;/a&gt;, which was far more flexible, and a lot more reliable. &lt;/p&gt;  &lt;h5&gt;&lt;u&gt;What's next… &lt;/u&gt;&lt;/h5&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&amp;quot;The future always arrives too fast... and in the wrong order.&amp;quot; –Alvin Toffler &lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;During this process, I've tweaked the build process that is generated quite a bit, added in a few more applications to the PGO training which cranks the performance up more and more. Now, I can add in more scripts to assist with the training pretty trivially, but it still takes some effort to package up an entire application like MediaWiki or Wordpress and include it into the build process.&amp;#160; Even once I've added in an application, I end up doing a whole slew of comparative testing to see what impact it has on the final executables. &lt;/p&gt;  &lt;p&gt;As time goes forward, I'm sure there's more tweaking to be done, but in all likelihood, any significant performance gains are going to be the result some modification of the PHP codebase itself.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9800643" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx">PHP</category><category domain="http://blogs.msdn.com/garretts/archive/tags/PHPonWin/default.aspx">PHPonWin</category></item><item><title>Crafting an Optimized PHP Build Process on Windows (Part III)</title><link>http://blogs.msdn.com/garretts/archive/2009/06/18/building-an-optimized-php-build-process-on-windows-part-iii.aspx</link><pubDate>Fri, 19 Jun 2009 00:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9777529</guid><dc:creator>GarrettS</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/garretts/comments/9777529.aspx</comments><wfw:commentRss>http://blogs.msdn.com/garretts/commentrss.aspx?PostID=9777529</wfw:commentRss><description>&lt;p&gt;&lt;i&gt;Previously, I had talked about using PGO in the PHP build process. In order to use it I had to observe…&lt;/i&gt;&lt;/p&gt;  &lt;h5&gt;&lt;u&gt;The Heisenberg build process &lt;/u&gt;&lt;/h5&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;i&gt;"A process cannot be understood by stopping it. Understanding must move with the flow of the process, must join it and flow with it." – The First law of Mentat, quoted by Paul Atreides to Reverend Mother Gaius Helen Mohiam &lt;/i&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Really, what I needed was a tool in two parts. The first would watch what happens during the build process, and the second would take that data and spit out some .vcproj files. &lt;/p&gt;  &lt;p&gt;When I want to see what's happening on my own system I use &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" mce_href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx"&gt;ProcMon&lt;/a&gt;—a &lt;a href="http://technet.microsoft.com/en-us/sysinternals/default.aspx" mce_href="http://technet.microsoft.com/en-us/sysinternals/default.aspx"&gt;Sysinternals&lt;/a&gt; tool that monitors processes, what files they touch, what commands get executed, etc. I grabbed that and tried to watch what happens when you run NMake on the makefile when building PHP. It turns out that are a few problems with that—ProcMon isn't very scriptable (making it tricky to automate) and even if it was, it has problems chopping off the command line in its log files when it's past a certain length. &lt;/p&gt;  &lt;p&gt;I found nothing else that did quite what I needed, so I started thinking about how to write a tool that does the same thing.&amp;nbsp; In the past I have used &lt;a href="http://research.microsoft.com/en-us/projects/detours/" mce_href="http://research.microsoft.com/en-us/projects/detours/"&gt;Detours&lt;/a&gt; (an API detouring library built by &lt;a href="http://research.microsoft.com/en-us/default.aspx" mce_href="http://research.microsoft.com/en-us/default.aspx"&gt;Microsoft Research&lt;/a&gt;) to build a couple quick-and-dirty snoop/debugging tools.&amp;nbsp; Starting with a sample that came from the Detours library, I cobbled together a tool that would watch a process and its children, recording every file written or read, every command issued, and dump it into an XML file which I could process later. &lt;/p&gt;  &lt;h5&gt;&lt;u&gt;Creating the project files &lt;/u&gt;&lt;/h5&gt;  &lt;p&gt;At the same time, I began working on a tool that would generate .vcproj files from the data gathered during the make process. I first tried just putting together a tool which assembled the .vcproj XML file from what I knew about the layout of the project file, but as the build got trickier, the xml was getting harder to make sure it came out the way that Visual Studio expected.&amp;nbsp; I turned to the Visual Studio SDK to see if there are any COM objects I could use to manipulate project files—there were, but they aren't documented in great detail, and they were really designed to be used to inside Visual Studio for automation. Having scoured the planet, I found some examples of using the VCProjectEngine to generate project files. &lt;/p&gt;  &lt;p&gt;For a couple of weeks solid, I worked on the tool to generate project files, compiling, testing, tweaking, etc.&amp;nbsp; I finally reached a point where I generated a project file completely that would compile the php.exe and php5.dll . Having finally arrived at this point, I built PHP using PGO instrumentation, ran the bench.php script from the PHP source directory, and then re-linked the project. This first time, I saw about an 18% improvement in speed over the previous version! &lt;/p&gt;  &lt;h5&gt;&lt;u&gt;That moment &lt;/u&gt;&lt;/h5&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;i&gt;"It ain't over 'til it's over, and maybe not then, either. " – Slovotsky's Law #29 &lt;/i&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Well, as anyone who's done software development will tell you, there's the moment when you finally get your program to do what you want under very controlled conditions, and then—quite some time later—there's the moment that you can give the fruits of that labor to someone else so they can do the same thing. &lt;/p&gt;  &lt;p&gt;Now that I had passed the point where I'd finally proven that it was worth the effort to build a PGO-optimized version of PHP, I had to get it scripted so that it could be done in an automated fashion, not just on my computer, or a computer in our Lab. &lt;/p&gt;  &lt;p&gt;&lt;i&gt;In the final part, I wrap up with the automation of the build and look to where we might go next in PHP.&lt;/i&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9777529" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx">PHP</category><category domain="http://blogs.msdn.com/garretts/archive/tags/PHPonWin/default.aspx">PHPonWin</category></item><item><title>Crafting an Optimized PHP Build Process on Windows (part II)</title><link>http://blogs.msdn.com/garretts/archive/2009/06/12/crafting-an-optimized-php-build-process-on-windows-part-ii.aspx</link><pubDate>Fri, 12 Jun 2009 22:13:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9737682</guid><dc:creator>GarrettS</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/garretts/comments/9737682.aspx</comments><wfw:commentRss>http://blogs.msdn.com/garretts/commentrss.aspx?PostID=9737682</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;I had talked about getting started in building the PHP stack last time, now I’m taking it…&lt;/em&gt;&lt;/p&gt;  &lt;h5&gt;&lt;u&gt;One step further&lt;/u&gt;&lt;/h5&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&amp;quot;We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.&amp;quot; – Donald Knuth &lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;A chance conversation I had last summer at OSCON with Trent Nelson—who was building Python on Windows—had planted the seeds of how to get PHP on Windows optimized further.&amp;#160; Trent was using the PGO features of Visual Studio to generate Python binaries that run faster.&amp;#160; Rather than spend a lot of time optimizing all the little bits of PHP itself, I thought that this would be an ideal way to improve the overall speed of PHP, provided I could find the right scenarios to train PHP with.&amp;#160; Little did I know that finding the right scenarios wasn't the hardest part. &lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="50"&gt;&amp;#160;&lt;/td&gt;        &lt;td bgcolor="#c0c0c0" valign="top"&gt;&lt;a href="http://en.wikipedia.org/wiki/Profile-guided_optimization"&gt;&lt;strong&gt;What is PGO?&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;em&gt;(from Wikipedia)            &lt;br /&gt;&lt;strong&gt;Profile-guided optimization&lt;/strong&gt; (&lt;b&gt;PGO&lt;/b&gt;) is a &lt;/em&gt;&lt;a href="http://en.wikipedia.org/wiki/Compiler"&gt;&lt;em&gt;compiler&lt;/em&gt;&lt;/a&gt;&lt;em&gt; optimization technique in &lt;/em&gt;&lt;a href="http://en.wikipedia.org/wiki/Computer_programming"&gt;&lt;em&gt;computer programming&lt;/em&gt;&lt;/a&gt;&lt;em&gt; to improve program runtime performance. In contrast to traditional optimization techniques that solely use the &lt;/em&gt;&lt;a href="http://en.wikipedia.org/wiki/Source_code"&gt;&lt;em&gt;source code&lt;/em&gt;&lt;/a&gt;&lt;em&gt;, PGO uses the results of test runs of the instrumented program to optimize the final generated code. The compiler is used to access data from a sample run of the program across a representative input set. The data indicates which areas of the program are executed more frequently, and which areas are executed less frequently. All optimizations benefit from profile-guided feedback because they are less reliant on &lt;/em&gt;&lt;a href="http://en.wikipedia.org/wiki/Heuristic"&gt;&lt;em&gt;heuristics&lt;/em&gt;&lt;/a&gt;&lt;em&gt; when making compilation decisions.&lt;/em&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h5&gt;&lt;u&gt;Adding PGO to the existing build process &lt;/u&gt;&lt;/h5&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&amp;quot;I have not failed, I've just found 10,000 ways that won't work.&amp;quot; – Thomas Edison&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I had downloaded the source to the dependent libraries off the PHP wiki, checked out the PHP source code, and began the process of adding in PGO support to the existing build process. This proved to be extremely difficult.&amp;#160; Even limiting the scope to just the core of PHP itself—without the dependent libraries, I ran trouble trying to compile using PGO instrumentation and then re-linking after running some tests.&amp;#160; The make file that gets generated by the configure.js script (a JScript version of the automake configure script for the Windows platform) was just not built with what I had in mind. &lt;/p&gt;  &lt;p&gt;I spent the better part of two weeks trying different approaches to tweaking the makefile so that I could use PGO to improve the PHP executable, but I kept running into roadblocks.&amp;#160; Worse, the closer I got to a makefile that did that I wanted, the farther away from the current build process I was getting, and I wasn't sure that what I would end up with would even be close to what was being built today. &lt;/p&gt;  &lt;h5&gt;&lt;u&gt;The long dark winter road &lt;/u&gt;&lt;/h5&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&amp;quot;Only the meek get pinched. The bold survive.&amp;quot; – Ferris Bueller&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I came to the conclusion that I'd have to build new Visual Studio project files from scratch.&amp;#160; What worried me is that this would end up to be a completely different build process and I'd never get the community to abandon what was already working, so I'd better be able to rebuild these new project files easily.&amp;#160; I started looking (inside Microsoft and out) for any tools which generated Visual C++ project files.&amp;#160; I found someone internally who had used some JScript to create project files from text files, but after some experimentation, I found this was nowhere near what I needed.&amp;#160; What I really needed was a way to convert the generated Makefile into a .vcproj file—and not just 'wrap' it. &lt;/p&gt;  &lt;p&gt;Once I found there was no such tool* , I began trying to figure out how to create one. I had this idea a few times in the last decade or so: watch how a program was compiled, and create a project file that does the same thing. Having tossed around the idea in my head before, I knew it wasn't going to be trivial, but without it, I couldn't do what needed to be done. &lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="50"&gt;&lt;em&gt;&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;em&gt;* Let me tell you: you &lt;strong&gt;never&lt;/strong&gt; want to think about writing a tool to parse out what a makefile does.&amp;#160; It's rather like making a tool that tells you how sausage is made, in excruciating detail. Ugh.&lt;/em&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;em&gt;In Part III, I’ll talk about the trouble with observing the build process.&lt;/em&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9737682" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx">PHP</category></item><item><title>Crafting an Optimized PHP Build Process on Windows (Part I)</title><link>http://blogs.msdn.com/garretts/archive/2009/06/09/crafting-an-optimized-php-build-process-on-windows-part-i.aspx</link><pubDate>Wed, 10 Jun 2009 01:18:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9718598</guid><dc:creator>GarrettS</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/garretts/comments/9718598.aspx</comments><wfw:commentRss>http://blogs.msdn.com/garretts/commentrss.aspx?PostID=9718598</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;The last several months, I’ve been working very deeply with PHP—specifically—compiling the PHP core itself, and looking for avenues for optimization. This is the first of four posts about the journey I’ve been on with PHP.&lt;/em&gt;&lt;/p&gt;  &lt;h5&gt;&lt;u&gt;     &lt;br /&gt;I get started building PHP&lt;/u&gt;&lt;/h5&gt;  &lt;blockquote&gt;&lt;u&gt;&lt;/u&gt;    &lt;p&gt;&lt;em&gt;&amp;quot;It is a bad plan that admits of no modification&amp;quot; – Publilius Syrus &lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I started working with building PHP itself about a year ago. Initially, I was trying to put together an environment to compile up the PHP stack so that I could do some debugging, and track down a few faults that we were encountering in some of the PHP applications that we were trying to modify to use the &lt;a href="http://sql2k5php.codeplex.com/"&gt;SQL Server PHP driver&lt;/a&gt; that the SQL Server team here at Microsoft was creating. &lt;/p&gt;  &lt;p&gt;Once I began to work with the source code, I found out very quickly that on top of having a hard time recreating the exact same binaries that the community build process generated, there were a large number of dependent libraries that were available in &lt;strong&gt;binary-only&lt;/strong&gt; form which were kept in a zip file that was passed around from developer to developer. That seemed a little odd for an open-source project but I can certainly understand that over time, unless someone is working hard to keep it all together, these things happen. &lt;/p&gt;  &lt;p&gt;Around the same time, the community had started to invest a time and effort to 'clean up' the dependencies for building PHP on Windows, and move towards supporting VC9 (Visual Studio 2008) as an officially supported compiler. &lt;/p&gt;  &lt;p&gt;In order to help in this process, I built out some testing environments in our Lab, which would let me compile up PHP on Windows and Linux, in order to get decent and reliable test results which we could use to identify any shortcomings that we could address. This includes benchmarking not just the core PHP executable, but replicable and comparable testing of PHP applications such as Wordpress, MediaWiki, Gallery and phpBB. &lt;/p&gt;  &lt;h5&gt;&lt;u&gt;PHP 5.3 on Windows: Not your father's PHP &lt;/u&gt;&lt;/h5&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;&amp;quot;I'm looking for a lot of men who have an infinite capacity to not know what can't be done.&amp;quot; – Henry Ford &lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;For PHP 5.3, &lt;a href="http://blog.thepimp.net/"&gt;Pierre&lt;/a&gt; (and others) had gone out and found up-to-date versions of all the dependencies, brought them together, and managed to get them compiling with VC6 and VC9.&amp;#160; They had posted these in binary and source form to the &lt;a href="http://wiki.php.net/internals/windows"&gt;PHP Windows Internals&lt;/a&gt; site, which allows anyone to rebuild the PHP stack on Windows, and theoretically, get the same results as the 'official' build. &lt;/p&gt;  &lt;p&gt;Jumping in at that point was much easier than it had been, as all you had to do was download the binaries of the libraries, check out the source code, and run a few commands at the command line, and &lt;strong&gt;presto&lt;/strong&gt; you had your PHP executables.&amp;#160; &lt;/p&gt;  &lt;p&gt;At this point Pierre and I played around with the build flags on VC9 and found some settings that gave some pretty significant improvements to the speed of PHP vs. the speed of the VC6 version—and a lot of speed improvements to vs. the old 5.2x line of PHP. &lt;/p&gt;  &lt;h5&gt;&lt;/h5&gt;  &lt;p&gt;&lt;em&gt;In Part II, I’ll talk about the going one step further with optimization.&lt;/em&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9718598" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx">PHP</category></item><item><title>PHP on Windows Optimized build—Thread Safe version too!</title><link>http://blogs.msdn.com/garretts/archive/2009/05/18/php-on-windows-optimized-build-thread-safe-version-too.aspx</link><pubDate>Mon, 18 May 2009 22:10:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9625778</guid><dc:creator>GarrettS</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/garretts/comments/9625778.aspx</comments><wfw:commentRss>http://blogs.msdn.com/garretts/commentrss.aspx?PostID=9625778</wfw:commentRss><description>&lt;p&gt;I’ve just finished tweakin’ out the PGO (Profiled Guided Optimization) build script for PHP on Windows to crank out the thread-safe version of PHP as well.&lt;/p&gt;  &lt;p&gt;So, now you can test PHP 5.3 RC3-dev PGO optimized for Windows with Apache 2.2!&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;What’s the difference between thread-safe and non-thread-safe?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The non-thread-safe version of PHP should be used when there is a single request per instance of PHP--like, when you use FastCGI—a single PHP-CGI.EXE handles a single request at a time, and the Web Server spins off multiple instances of PHP-CGI.EXE to handle requests in parallel. Because each instance is in a separate process, there is no need to have all the thread-safety code in PHP.&lt;/p&gt;  &lt;p&gt;The thread-safe version is required when you use PHP as a module—as you would in Apache on Windows—and the WebServer handles multiple requests in the same process.&lt;/p&gt;  &lt;p&gt;Given the choice, the non-thread-safe version should be faster, and if you can, you should probably use that one.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;You can read more about this at &lt;a href="http://www.iis-aid.com/articles/my_word/difference_between_php_thread_safe_and_non_thread_safe_binaries"&gt;http://www.iis-aid.com/articles/my_word/difference_between_php_thread_safe_and_non_thread_safe_binaries&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;If you already use the thread-safe version of PHP on Windows, please download and test this version if you can—and send me some feedback!&lt;/strong&gt;&amp;#160; &lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;strong&gt;Links to the latest PHP 5.3 Builds:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;PHP 5.3-RC-dev snapshots:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a title="http://windows.php.net/downloads/snapsoptimized/" href="http://windows.php.net/downloads/snapsoptimized/"&gt;http://windows.php.net/downloads/snapsoptimized/&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;Non-thread-safe:&lt;/em&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;u&gt;&lt;font color="#dd4a21"&gt;&lt;a href="http://windows.php.net/downloads/snapsoptimized/php-5.3-nts-win32-VC9PGO-x86-latest.zip"&gt;http://windows.php.net/downloads/snapsoptimized/php-5.3-nts-win32-VC9PGO-x86-latest.zip&lt;/a&gt;&lt;/font&gt;&lt;/u&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;Thread Safe:&lt;/em&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://windows.php.net/downloads/snapsoptimized/php-5.3-ts-win32-VC9PGO-x86-latest.zip"&gt;http://windows.php.net/downloads/snapsoptimized/php-5.3-ts-win32-VC9PGO-x86-latest.zip&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9625778" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx">PHP</category><category domain="http://blogs.msdn.com/garretts/archive/tags/PHPonWin/default.aspx">PHPonWin</category></item><item><title>PHP 5.3 RC2 *Highly-Optimized* for Windows available</title><link>http://blogs.msdn.com/garretts/archive/2009/05/07/php-5-3-rc2-highly-optimized-for-windows-available.aspx</link><pubDate>Thu, 07 May 2009 23:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9594811</guid><dc:creator>GarrettS</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/garretts/comments/9594811.aspx</comments><wfw:commentRss>http://blogs.msdn.com/garretts/commentrss.aspx?PostID=9594811</wfw:commentRss><description>&lt;p&gt;Howdy, &lt;/p&gt;  &lt;p&gt;I’ve been working for many months with &lt;a href="http://blog.thepimp.net/" mce_href="http://blog.thepimp.net/"&gt;Pierre Joye&lt;/a&gt;—well really, &lt;b&gt;many &lt;/b&gt;people in the PHP community--on getting PHP to run faster on Windows.&lt;/p&gt;  &lt;p&gt;Pierre has been working rapidly on upgrading libraries (Pierre pioneered the work to get PHP and its hoard of dependent libraries updated and properly compiling on Windows), replacing old POSIX-emulation code with native calls, patching bugs, and about a million other things, all of which had a huge impact on performance and stability of PHP on Windows.&lt;/p&gt;  &lt;p&gt;For my part, I’ve been spending my time behind the scenes by feeding information to Pierre that he needs, testing, analyzing, and finally by constructing a new build process that enables us to take advantage of some pretty sweet optimization technology in Visual Studio.&lt;/p&gt;  &lt;p&gt;Starting today, you can find snapshot builds of PHP 5.3 that are built using my optimized build process on the &lt;a href="http://windows.php.net/downloads/snapsoptimized/" title="Optimized Snapshots of PHP 5.3" mce_href="http://windows.php.net/downloads/snapsoptimized/"&gt;windows.php.net&lt;/a&gt; site:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Current PGO Optimized Snapshot:&lt;/b&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://windows.php.net/downloads/snapsoptimized/php-5.3-nts-win32-VC9PGO-x86-latest.zip" title="http://windows.php.net/downloads/snapsoptimized/php-5.3-nts-win32-VC9PGO-x86-latest.zip" mce_href="http://windows.php.net/downloads/snapsoptimized/php-5.3-nts-win32-VC9PGO-x86-latest.zip"&gt;http://windows.php.net/downloads/snapsoptimized/php-5.3-nts-win32-VC9PGO-x86-latest.zip&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;b&gt;A few Notes:&lt;/b&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Over the course of the next couple of weeks, I’ll be explaining how this build process works, and making available the tools that make it all possible.&amp;nbsp; &lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;Only the non-thread-safe version is available, so you need to use FastCGI with IIS in order to use it.&lt;/p&gt;    &lt;p&gt;Since this is a radically different build than the ones that had been traditionally used to create the Windows PHP binaries, you should download the binaries and test with them, but you probably should avoid using them in production just yet.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If you have any feedback about the builds, leave me a comment, or send me mail at    &lt;br&gt;    &lt;br&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="mailto:garretts@microsoft.com" mce_href="mailto:garretts@microsoft.com"&gt;garretts@microsoft.com&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9594811" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx">PHP</category></item><item><title>Interesting thing found at OSCON: Taint</title><link>http://blogs.msdn.com/garretts/archive/2008/07/23/interesting-thing-found-at-oscon-taint.aspx</link><pubDate>Thu, 24 Jul 2008 00:25:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8767735</guid><dc:creator>GarrettS</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/garretts/comments/8767735.aspx</comments><wfw:commentRss>http://blogs.msdn.com/garretts/commentrss.aspx?PostID=8767735</wfw:commentRss><description>&lt;p&gt;I attended a session this morning called &amp;quot;&lt;strong&gt;PHP Taint Tool: It Ain't a Parser&lt;/strong&gt;&amp;quot; by Luke Welling. Luke introduced a tool he's working on at OmniTI that is designed to assist in sniffing out where the potential for untrusted input is handled. From the session description:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;... You want to see where untrusted input can propagate taint within the application. In complex logic that might mean chasing many possible execution paths. Using an automatic tool to try to follow these paths without running all possible input variations is called static analyis. ...&lt;/em&gt;&lt;em&gt; The Taint tool allows the PHP engine to do as much as possible, then cuts in at the last stage to analyze the compiled opcodes and trace possible flow of execution.&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;The Taint tool presents opcodes in a readable way, making it clear what lines of source got compiled into specific opcodes. It also performs a static analysis on the code, following the opcodes to attempt to trace all possible code branches and mark lines that tainted data can be passed to.&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Essentially, the tool uses the parts of the PHP engine to compile PHP code to opcodes, and then tracks where data comes and goes, and highlights the code that handles data that *could* be tainted--that is, input from the user either by POST or GET parameters.&amp;#160; This provides a facility for a developer to identify the lines that they should closely review to ensure that they are not accidentally introducing security holes (like cross-site-scripting opportunities).&amp;#160; &lt;/p&gt;  &lt;p&gt;Now, it's not-quite-ready for prime-time, but it's getting close, and the folks over at &lt;a href="http://labs.omniti.com/"&gt;OmniTI&lt;/a&gt; intend to release it as open source when they are ready.&amp;#160; When this gets released, I'll be really excited, as it looks like it could be really good for hunting down security holes.&lt;/p&gt;  &lt;p&gt;I also attended Rasmus Lerdorf's (the Yahoo PHP guy) tutorial on &lt;strong&gt;&amp;quot;PHP: Architecture, Scalability, and Security&amp;quot; &lt;/strong&gt;that was really quite good too, and he demonstrated a tool (&lt;em&gt;the name of which I can't remember now...grrr&lt;/em&gt;) that they have at Yahoo that he points to a web page, and it starts throwing a large library of strings that may uncover security problems, but it does it from the client side.&amp;#160; Unfortunately, he's &lt;strong&gt;not &lt;/strong&gt;releasing it, not because he doesn't want to let folks find and fix their bugs, but because the release of a such a tool could bring about Internet Armageddon--it would likely find exploitable problems in the &lt;em&gt;vast majority &lt;/em&gt;of the Internet.&amp;#160; &lt;/p&gt;  &lt;p&gt;Both approaches to finding application holes are useful, and it's clear from both talks that this is still a really large problem that developers need to address.&lt;/p&gt;  &lt;p&gt;&lt;font face="aria" size="1"&gt;(I've had a problem with spam comments; I'll be addressing that soon, so if you see comments turned off you can drop me a email: garretts&lt;i style="visibility: hidden"&gt;...&lt;/i&gt;at&lt;i style="visibility: hidden"&gt;...&lt;/i&gt;microsoft&lt;em&gt;&lt;i style="visibility: hidden"&gt;...&lt;/i&gt;&lt;/em&gt;dot&lt;i style="visibility: hidden"&gt;...&lt;/i&gt;com)&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8767735" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/garretts/archive/tags/open+source/default.aspx">open source</category><category domain="http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx">PHP</category><category domain="http://blogs.msdn.com/garretts/archive/tags/OSCON/default.aspx">OSCON</category></item><item><title>Blame it on your lying, cheating, cold dead-beating, two-timing, double-dealing mean mistreating, loving heart</title><link>http://blogs.msdn.com/garretts/archive/2008/07/21/blame-it-on-your-lying-cheating-cold-dead-beating-two-timing-double-dealing-mean-mistreating-loving-heart.aspx</link><pubDate>Mon, 21 Jul 2008 22:57:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8762476</guid><dc:creator>GarrettS</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/garretts/comments/8762476.aspx</comments><wfw:commentRss>http://blogs.msdn.com/garretts/commentrss.aspx?PostID=8762476</wfw:commentRss><description>&lt;p&gt;Ever notice how folks who blog sporadically (uh, like me!) always apologize for not blogging for a while, and then re-affirm their dedication to blogging regularly? And often, accompanying their apology, is also a reason. I was going to &amp;quot;&lt;a href="http://en.wikipedia.org/wiki/Blame_It_on_the_Rain"&gt;Blame it on the Rain&lt;/a&gt;&amp;quot; but the very thought of quoting &lt;a href="http://en.wikipedia.org/wiki/Milli_Vanilli"&gt;Milli Vanilli&lt;/a&gt; makes me shudder. &lt;/p&gt;  &lt;p&gt;So, instead, &lt;a href="http://en.wikipedia.org/wiki/Patty_Loveless"&gt;Patty&lt;/a&gt; gets to explain it for me.&amp;#160; Well, now that I think about it, it really doesn't explain anything. But I was listening to that song last night, and the lyrics stuck in my head. &lt;/p&gt;  &lt;p&gt;..... Aaaaaanyway...&lt;/p&gt;  &lt;p&gt;The worst part about not blogging for weeks on end is that I can't just ramble on as if you know what I've been up to for the last last few weeks, but I'll try to catch ya up:&lt;/p&gt;  &lt;p&gt;Over the last several weeks, I've been moving my focus from doing &amp;quot;Program Management&amp;quot; tasks to more &amp;quot;Software Developer&amp;quot; tasks. You see, during the last year, I've discovered that I'm a Developer. Deep down, that's what I do best. Focusing in that direction is already paying off, and I'm finding that I'm accomplishing far more than I had before.&lt;/p&gt;  &lt;p&gt;So, rather than focus on simply facilitating, I've been actually compiling, debugging, coding... aaaahhh. It's so nice.&lt;/p&gt;  &lt;p&gt;And the best part: all the work that I'm doing is dedicated to getting Apache and PHP working much better on the Windows platform. I may just possibly have the absolute best job at Microsoft. &lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c9c60913-15c4-4cd6-851c-252207ce1594" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/OSCON" rel="tag"&gt;OSCON&lt;/a&gt;,&lt;a href="http://technorati.com/tags/PHP" rel="tag"&gt;PHP&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Apache" rel="tag"&gt;Apache&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8762476" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx">PHP</category><category domain="http://blogs.msdn.com/garretts/archive/tags/OSCON/default.aspx">OSCON</category><category domain="http://blogs.msdn.com/garretts/archive/tags/Apache/default.aspx">Apache</category></item><item><title>Looking for a few good outriders: PHP Developers</title><link>http://blogs.msdn.com/garretts/archive/2008/01/16/looking-for-a-few-good-outriders-php-developers.aspx</link><pubDate>Wed, 16 Jan 2008 23:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7134629</guid><dc:creator>GarrettS</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/garretts/comments/7134629.aspx</comments><wfw:commentRss>http://blogs.msdn.com/garretts/commentrss.aspx?PostID=7134629</wfw:commentRss><description>&lt;P&gt;Hey y'all.&lt;/P&gt;
&lt;P&gt;I've got some work goin' on that I sure could use a few hands that were real PHP savvy.&lt;/P&gt;
&lt;P&gt;I'm looking for some short-term and some mid-term consultants to do some experimental work with PHP applications on Windows. I have need for some local (Redmond) and some can work from remote.&lt;/P&gt;
&lt;P&gt;If you have some real fine PHP skills, including experience with databases, and have a track record of producing results, I'd be happy to hear from you.&lt;/P&gt;
&lt;P&gt;Tell me... are you up to it?&lt;/P&gt;
&lt;P&gt;Send me a mail: &lt;STRONG&gt;garretts at microsoft.com.&lt;/STRONG&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7134629" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/garretts/archive/tags/fear+the+cowboy/default.aspx">fear the cowboy</category><category domain="http://blogs.msdn.com/garretts/archive/tags/open+source/default.aspx">open source</category><category domain="http://blogs.msdn.com/garretts/archive/tags/PHP/default.aspx">PHP</category></item></channel></rss>