Blog Posts

Apache HOSTNAME on Clusters

In an effort to debug issues on a cluster, I was trying to determine which machine on the cluster was causing the issue. My idea was that I could insert a header token identifying the server.

My first idea was to add the directive Header add X-Server-Ip "%{SERVER\_ADDR}e in my httpd.conf. However, due to the nature of our load balancer, Apache was somehow resolving this to the load balancer IP address on all machines of the cluster — which was really, really not useful.

I finally stumbled on a good solution, however: you can set environment variables in apachectl, and then pass them into the Apache environment using the PassEnv directive from mod_env; once that's done, you can use the environment variable anywhere.

In my apachectl, I added the line export HOSTNAME=\hostname``. Then, in my httpd.conf, I added first the line PassEnv HOSTNAME, followed by the directive Header add X-Server-Name "%{HOSTNAME}e". Voilá! I now had the hostname in the header, which gave me the information I needed for debugging.

Continue reading...

2007 Retrospective

2007 was a busy year, both personally and professionally. I won't go into the personal too much, because, well, it's personal, and some of the details are simply inappropriate for blogging material.

Here's the short version:

  • One trip to Belgium and The Netherlands.
  • Two trips to Israel.
  • Two trips to Atlanta, GA (not counting the return trip from Europe, when I was stranded for a day due to storms in the Northeast).
  • Three different user groups attended, with three presentations.
  • One major Zend Framework release
  • One PEAR release.
  • One podcast.
  • One webinar.
  • One book published.
  • One conference attended.

What follows is my month-by-month breakdown:

Continue reading...

Sqlite Version Mismatch

I ran into an issue recently in testing a site where PDO_SQLITE was claiming that it could not read my PDO database files. The only recent change I'd had was that I'd installed a new version of PHP, and hence a new version of PDO_SQLITE. Searching the web (we're not supposed to say googling or googled anymore, remember ;-)), I found that the issue was that the version of sqlite compiled into my PHP install was not compatible with the version I used to create the databases in the first place. Never mind that they're only a micro version or two different.

So, I was left with a conundrum: I needed to create files compatible with my PDO_SQLITE install, but my CLI sqlite tool was incompatible. And if I used PDO_SQLITE to create the db file, I'd lose my data, right?

Wrong. And here's what you can do should you find yourself in the same situation sometime.

Continue reading...

Zend_Layout and Zend_View Enhanced components now in core

I'm pleased to announce that the Zend_View Enhanced and Zend_Layout components are now in the Zend Framework core. With these two components, you can now create some truly complex views for your application with relative ease.

The two components tackle several view related tasks:

  • Layouts, or Two Step Views
  • Partials (view fragment scripts with their own variable scope)
  • Placeholders (store data and/or markup for later retrieval)
  • Actions (dispatch a controller action)

Continue reading...

Burlington PHP Users Group, December

I've been considering for a good six months trying to organize a PHP Users Group for the Burlington, VT, area. When we first moved to Vermont, I was surprised (and excited) by the number of PHP shops (which at the time I saw as job potential, as I was looking for work), and actually walked my resume around to a half-dozen or so. The area has a ton of PHP developers, and it only makes sense to have a UG where we can exchange tips and tricks of the trade.

Then, about six weeks ago, I mentioned this to my friend Rob. He did what I should have done all along, and googled for an existing group — and found one!

The Burlington, VT PHP Users Group has been around since November of 2005 on Google Groups, but we're having our inaugural meeting this coming Wednesday, 5 December 2007. I'll be speaking at this first meeting on Zend Framework's MVC components

If you're in the Burlington area this Wednesday, you should stop by. For more details, visit the event page, and don't forget to RSVP.

Continue reading...

I is a published author!

So, in addition to it being my daughter's birthday, which is exciting enough in itself, I received a package from my publisher, SitePoint, with my author copies of The PHP Anthology. Very exciting to see stuff I've written published!

Continue reading...

PHP Anthology, 2nd Edition is out

Well, it's now official: The PHP Anthology, 2nd Edition is finally out, and, as you'll see if you follow the link, I'm listed as an author on it. :-) It's a pleasant surprise to see it out — I finished my chapters back in January, and had almost forgotten about it.

Continue reading...

Gutsy Gibbon review

Early in the week, I decided to avoid the release rush and go ahead and update my laptop to Ubuntu's Gutsy Gibbon release. Overall, it's quite good, with one caveat I'll elaborate on later.

Continue reading...

ZendCon is over at last

ZendCon '07 is finally over, the dust has settled, and I finally find myself with some time alone… practically the first I've had since Sunday. The week was fantastic, and I had many good conversations and brainstorming sessions. Oh, and I ended up giving three different sessions, so it's time for links to slides and materials:

  • Best Practices of PHP Development. Sebastian, Mike, and I presented a full-day tutorial on PHP development best practices, focussing primarily on testing and testing strategies, but also covering coding standards, usage of SCM tools, and deployment. There were a ton of questions from the attendees, and Sebastian even whipped out some extra slides at the end showing new and little-known features of PHPUnit. Basically, reading the slides won't really indicate what we covered, but is more of a general outline. It was an honor and pleasure to work with Sebastian and Mike on this, and I hope we can do it again in the future some time.
  • Zend Framework MVC Quick Start. This was basically the same session I did in my webinar a couple weeks ago, with a few corrections and a small demonstration. Cal put me on directly following Terry Chay, in the largest of the four session rooms — the one where all the keynotes occurred — talk about intimidating! Amazingly, the session was really well attended — others I talked to estimate between 100 and 150 people showed up. The most amazing part, though, was that when I asked how many people knew what 'MVC' was, I don't think there was a single person who didn't raise their hand — definitely a sign of how well accepted the pattern now is in PHP.
  • AJAX-Enabling Your Zend Framework Controllers. I did this talk for the Unconference, mainly because its a topic I've been interested in and wanted to present. In it, I detailed how to ajax-enable an application through some easy tricks with Action and View Helpers and using JS to decorate your existing application. The reference app I used was a pastebin, and I've got code for both Dojo and Prototype flavors available:

The two highlight keynote speakers, for me, were definitely Joel Spolsky and Cory Doctorow. Neither spoke about PHP, but both spoke about topics that PHP developers should take to heart. Perhaps I'll elaborate on those in another post.

Another bonus for me was the number of old and new friends alike I got to see — I had many good conversations with Paul M. Jones, Nate Abele, Ivo Jansch, and Ralph Schindler, and opportunities to finally meet fellow co-author Lig Turmelle, Ben Ramsey, Chris Shifflet (dude, we've been to four conferences together, and never yet met!), and many, many others. I was also overwhelmed by the number of Zend Framework users who sought me out either to ask me questions or simply thank me and the others on the team for the project; I'm deeply honored that I can work on a project that affects so many developers.

And now for some down time to recuperate…

Continue reading...

oh, yeah, zendcon...

I don't know why I haven't blogged this sooner, but, yes, I'll be speaking once again at ZendCon:

I'll be presenting a number of times:

  • On Monday, I join Sebastian Bergmann and Mike Naberezny in a full-day tutorial session on PHP Development Best Practices and Unit Testing. This expands on what Mike and I did last year, and will more heavily emphasize the role of testing in the development process — arguably the most important best practice you can adopt.
  • On Tuesday monrning, I'll present a Zend Framework MVC Quick Start. This talk is based on a webinar I recently gave for Zend, and covers the various pieces of the MVC layer in Zend Framework.
  • Tuesday evening, I'll present an Unconference session on Ajax-enabling your Zend Framework controllers. I don't know yet if I'll need the whole hour, but I can probably fill it up with some examples of decorating your apps with AJAX.

Looking forward to seeing you all there!

Continue reading...