Today Microsoft announced the official release of their FastCGI extension for IIS 5.1/6.0, which greatly improves the performance and reliability of PHP on Windows’ flagship web server.
Running Your PHP Applications on IIS
Programming with Configuration Files
Recently I was working on developing an application that required a configuration file to setup. I considered several options for the file, keep it in the native language (PHP), make it plain-text or use XML. I didn’t like any of the options because the configuration has to be approved by certain stakeholders of the data at various stages throughout the life of the application.
XML is too hard to read for management-types. Plain text wasn’t all that easy to handle from a code perspective. I could have used a native language configuration file that read more like plain text (mostly comments, few directives, etc), but still was not liking it.
Then I remembered that when I played with Ruby on Rails it used something called YAML, and thought I’d give that go. It didn’t take too long at all to get the hang of writing the syntax for YAML. I then needed to find a way to process it with PHP. I found a few.
I started with the top entry on a Google search for PHP YAML. I found spyc, which is a very simple YAML class for PHP. I also found Syck, which is apparently more widely used and ported to several languages (although Ruby looks to be the primary focus). But I decided to download spyc, which appeared to geared toward PHP, gave it a whirl and instantly had what I needed. I liked it so much, I packaged it up for Fedora. I should probably also mention that I looked at JSON, but found YAML to be more complete and easier to read for what I needed to do. JSON is cool though in that it is a subset of YAML for the most part and works nicely with Python.
Zend Framework 1.0 Production Released!
Today Zend announced the official release of the Zend Framework 1.0!! I’ve been using the ZFW for some time now, and already have it running in a production environment (to power http://www.beginningphpandmysql.com/). Can’t say enough good things about it, if you’re looking for a killer MVC framework with plenty of opportunities for extensibility, check it out.
Symfony Forge Launched!!!
Along with the Zend Framework and CakePHP, the symfony web framework is considered to be one of the PHP “big three” frameworks. Having personally used it for a few projects, I can vouch for its power, flexibility, and ease of use, and in fact am so enthusiastic about it that we published the definitive book on the topic (written by symfony’s creator and lead developer) just a few months ago.
This week the project took another major step forward with the launch of symfony Forge!. Intended to be a central location for community plug-ins, discussion, and other tools, if you’re using symfony I strongly encourage checking it out.
Delphi for PHP
Apress author Chris Judd wrote to let us know Borland is going to soon release Delphi for PHP, which it’s touting as the “first competely integrated visual Rapid Application Development environment for PHP”.
This is certainly an interesting development, as visual PHP development tools have long been sorely missing. While I’m very happy with PDT, clearly there’s a significant market for these sorts of tools. I’ll contact Borland about obtaining a review copy, look for an update here in the coming weeks.
Learn more about Delphi for PHP
Jason
symfony 1.0 Released!
Francois Zaninotto wrote this morning to inform me that symfony 1.0 has been released! I’ve been using the symfony framework for several months now, and personally think it to be the best of the bunch. If you’re looking for a great PHP framework, this is it.
The timing of this release was impeccable, as Francois and fellow symfony lead contributor Fabien Potencier co-authored “The Definitive Guide to symfony”, which Apress published just last month. The book is 1.0-compliant so check it out if you’re looking for a great learning resource.
Jason
Zend Framework Cache Improvement

Possible addition to array syntax in PHP

FastCGI Technical Preview 2 Released!
A few months ago I reported on Microsoft’s attempts to improve PHP’s performance on the Windows platform. A short time later, Zend and Microsoft announced a partnership intended to make this effort official.
The result of this collaboration is coming to fruition, as this week they released the second technical preview release of FastCGI.
Progress in this area is a pretty big deal, because countless PHP developers have historically built their web applications on Windows, only to move them over to Linux due to these longstanding performance and stability issues. Soon these developers will be able to continue using a standardized environment if they so choose.
Learn more about the FastCGI release
Learn how to install FastCGI/PHP
Read Zend’s press release regarding the collaboration
Jason
PHP IDE now PDT

Introducting Primitus

Preview The Definitive Guide to Symfony
The authors of the upcoming book, The Definitive Guide to Symfony, have posted a sample chapter for you to get a sneak preview. The sample chapter covers Unit and Functional Testing and should be a treat for anyone interested in Symfony. (hint: you can find a different sample chapter at the first link in this post)
Viewing Large Record Sets in PHPMyAdmin
I’m currently working on an e-commerce project involving a relatively small number of database tables. However the clients table consists of 19 fields, making for difficult data review and debugging within PHPMyAdmin, even at 1280×768 resolution.
The answer is simple, at least if you’re using Firefox. Firefox offers three hotkeys for changing the text size, and resultingly, the amount of text you can see on one screen:
Ctrl+: Increase text size
Ctrl-: Decrease text size
Ctrl0: Return to default text size
When you’re dealing with a large table, just hit Ctrl- a few times. Once you’ve reviewed the data (or you’re eyes start to hurt), hit Ctrl0 to return to the default text size.
Initial Thoughts on the Zend Framework

Click here to read more
Very Nice Zend Framework Tutorial

Ilia Introduces mail() logging for PHP

I say this is a step in the right direction, because it does not address a PHP script being able to communicate directly with the SMTP server and not utilizing the mail function. It’s great that this is being done though, and hopefully it will make it into the PHP standard builds sometime soon.
PHP 5 Adoption Trends
I’ve come across a few rather interesting links regarding PHP 5 adoption that I thought worth passing along. With PHP 6 due out next year, it’s odd, and perhaps a bit disconcerting that PHP 5 adoption is so slow. Personally, I couldn’t imagine using version 4, what with all the great features PHP 5 brings to the table.
In a recent blog post, Ilia Alshanetsky cites some adoption numbers, asks his blog readers why they haven’t upgraded yet.
Notably, back on July 16, core PHP developer and Zend co-founder Andi Gutman posted a blog entry titled “PHP Adoption Has Tipped!”. He cites Zend’s technical support statistics as evidence PHP 5 adoption is tipping, noting over 50% of clients are using PHP 5. In fairness, he also cites other numbers which fly-in-the-face of this conclusion.
Jason
PHP Performance Roundup

symfony 1.0 Beta Released!
Over the last several months I’ve experimented with each of the “big three” PHP frameworks, namely CakePHP, symfony, and the Zend Framework. All three offer unique features and advantages, and are worth a serious look if you’re interested in using a “Rails-like” framework for the PHP language. However, of the three I’ve settled on symfony for current projects, and am experiencing great success using it to create a new e-commerce website I’m soon to deploy.
At any rate, yesterday version 1.0 beta was released! There’s quite a few impressive features and performance gains to be had with the new beta. I highly recommend taking a look at all symfony has to offer if you want to greatly streamline your website development time.
Namespaces in PHP 6
There’s a fairly interesting thread on the php-dev list regarding the inclusion of namespaces in PHP 6, you can find it here.
I find both sides of the argument quite compelling, and while FWIW I’m in favor of including them in the next release, I’m somewhat indifferent to the matter. According to one of the very latest messages in the thread, Zeev Suraski confirms they simplistic support will likely be enabled, stating:
“I think there are fair chances we’ll introduce a very simplistic namespaces capability in PHP 6. It’s pretty clear it will not have the notion of imports, and will be very much focused on classes (as opposed to functions and variables). In fact, I think you can very much imagine them as being a new way of writing a class name – just imagine you could specify a single colon (or whatever) in your class name.
Anything beyond that is going to result in a significant slowdown of the execution engine and open a can of warms regarding scoping and symbol resolution. Just to clarify what Rasmus said (which is indeed what was agreed for PHP 6) – we will add namespaces to PHP 6 if we can find a good way of defining their semantics in the PHP spirit as well as an acceptable way to implement it. Those two reasons very much limit what we can or cannot do with namespaces in PHP, especially the first one. ”.
Will be interesting to see how this pans out!
Jason
Installing PHP 6 Gotcha
PHP 6 has been in the works for some time now, and promises a number of long-awaited new features, including most notably complete Unicode support and namespaces. If you’re interested in giving the latest build a try, head on over to http://snaps.php.net, and download the latest source or Win32 package.
Presuming you’ll want to install it as an Apache 2 module, there’s a minor inconsistency that I’d imagine is tripping a few people up (present party included). When adding the LoadModule directive to Apache’s httpd.conf file, you need to continue referencing php5_module, even though you tie it to the php6 DLL. For instance, here’s what the relevant lines of my Windows httpd.conf file looks like:
LoadModule php5_module “c:/php60/php6apache2.dll”
#LoadModule php5_module “c:/php520/php5apache2.dll”
#LoadModule php5_module “c:/php514/php5apache2.dll”
#LoadModule php5_module “c:/php5/php5apache2.dll”
AddType application/x-httpd-php .php
PHPIniDir “c:/php60”
Also, note I’ve used the PHPIniDir directive to point to the location of the PHP 6-specific php.ini file. This is because the php.ini file has changed for PHP 6 due to the removal of several features.
Jason
Forms Validation with CakePHP
Neglecting to validate user input is akin to foregoing any defensive gameplan for containing the NFL’s leading rusher. Chances are sooner or later you’re going to get run over. Yet even in spite of the dire ramifications of doing otherwise, many developers choose to ignore the potential problems presented by user input, reasoning that data validation is tedious and distracts them from the larger goal of building a working application. The result? Corrupt and incorrect data, cross-site scripting and SQL injection attacks, and a giant headache come Monday morning.
There really is no way around it anymore: you must validate user input within every web application. However, because data validation is a task faced by all developers, and it follows a fairly rigorous specification regardless of where its ultimately applied, the task seems suitable for automation by a framework. CakePHP does exactly this, going a long way towards making data validation a snap.
In the second installment of this occasional Developer.com series on this powerful framework, I’d like to show you another way frameworks can make your life easier by demonstrating CakePHP’s data validation capabilities.
Microsoft inks multi-year deal with Zend
Upon my return from the Microsoft Web Developers’ Summit a few weeks ago, I penned an article for TechTarget discussing Microsoft’s efforts to ensure PHP runs smoothly on IIS. Today, Reuters is reporting this collaborative effort has been made official, with both sides agreeing to work together towards this goal.
Design Patterns and PHP
While developers should be able to think outside of the box, it’s clear that much of our job revolves around repeatedly implementing similar solutions, albeit within different problem-spaces.
The development community refers to these repeatable situations as patterns, and they help you write code faster and more efficiently. Because pattern implementation is heavily dependent upon a language’s object-oriented capabilities, PHP users have only really been able to take advantage of them since the version 5 release. In light of this, I thought I’d take a moment to compile a list of reading resources for those of you new to the topic, first listing a few language-agnostic definitions, and then moving on to a few tutorials and a book devoted to implementing patterns in PHP.
Click here to read more
Automate Amazon Research with the Zend Framework
Like most Web developers, I’ve become enamored with the myriad Web frameworks popping up everywhere. Symfony is very cool, as is Cake. But the Zend Framework offers a particularly compelling component that I couldn’t resist using for a recent personal project involving aggregating Amazon sales rank information for Apress’ open source line (of course we’ve long aggregated such statistics, but I wanted to recreate my own solution for kicks).
My latest SearchOpenSource tutorial describes this project, showing you how to take advantage of the Zend Framework to create your own aggregator. While it’s not an introduction to the framework, you should nonetheless be able to follow along fairly well provided you’ve some understanding of how MVC works.
PHP 5 Adoption has (not) Tipped!

Click here to read more
Serving Cached Data For Improved Performance

Over the past day I've been going through a few web applications and preparing them in the event they get digged or slashdotted. One of my primary goals was to cache as much data to disk, rather than hitting the database for it each time. Now, most of the web applications I have written myself, so I didn't have the luxury of some type of premade mod or plugin. In one case, this textpattern installation, I did have that luxury.
Click here to read more
The Power of PHPEclipse
All too often I come across beginning PHP tutorials in which the author praises the ease in which newbies can get acquainted with the language, and invites them to fire up their favorite text editor to begin coding. Because so many newcomers begin coding PHP on Windows, often this text editor is Notepad. Last time I checked, Notepad offered nothing by way of coding convenience, nor a means for extending the application to allow for such amenities.
Why not point newcomers to a tool that will help these individuals get further acquainted with PHP without getting lost in unnecessary organizational details such as tabbing between multiple windows (most notably editor and browser), having to hunt down missing quotation marks, and in the case of having a significant bug, being left to simple echo statements?
Click here to read more
Displaying Times and Dates in Other Languages with PHP

So far, all the date and time output has been in English. From the point of view of someone for whom English is the primary language, this is not necessarily a bad thing. However, quite a lot of people in the world use other languages and prefer to use websites in those languages. You do not want to display something like “Guten Morgen! Heute is Monday, der 15th March� to users of a German-language news portal any more than English-speaking users would want to see something like “Good Morning! It’s Montag, the 15. of März� on an English-language site.
Click here to read more
PHP4, The Energizer Bunny?

Click here to read more
Using the Google API from PEAR

Click here to read more
A Quick Tutorial of PEAR DB

Click here to read more
Xdebug: A PHP Debugger and Profiler

Click here to read more
Introducing Google’s Geocoding Service
My ongoing Developer.com series covering the Google Maps API (tutorial 1, tutorial 2, tutorial 3, tutorial 4) shows you how to use this great service to build interesting and useful spatial Web applications. Yet one of the glaring omissions from the API has been the ability to map locations without the use of third-party solutions for converting mailing addresses to their corresponding coordinates; just as is the case with the Yahoo! and Microsoft Virtual Earth mapping APIs, locations can only be pinpointed using their latitudinal and longitudinal descriptors. Whereas the latter two solutions have offered built-in conversion capabilities for some time, Google Maps API users have had to rely on services such as geocoder.us or the US Census Bureau TIGER/Line data for such tasks.
This longstanding feature request was satisfied on June 11 when Google quietly added geocoding capabilities to the API. What’s more, this feature isn’t limited to the U.S.; street-level geocoding is also offered for Canada, France, Germany, Italy, Japan, and Spain! While limited to 50,000 daily requests, it’s fair to say such constraints won’t affect most users, particularly if caching is implemented. This tutorial shows you how to use this new feature, further streamlining your use of this wonderful API.
Quick and Easy Ajax with PHP

Click here to read more
The #1 Security Flaw in PHP Applications

Click here to read more
Clean that input!

Click here to read more
