Tag Archives: php

Right place at the right time

Jim blogged about the PHP credits list, and so I took a look. I was amazed to notice that of all the people listed, I know at least half of them, and have met most of the others. I’ve been very lucky to be in the right place at the right time, and meet some amazing people, and get associated with a pretty amazing organization, and by extension, a bunch of others.

In the early days, when the term Open Source wasn’t quite as well known as it is now, I managed to meet a significant number of the folks responsible for Perl, and become friends with several of them. A few years later I started spending more time with Apache than with Perl, and that’s developed into speaking opportunities, books, interesting projects – but most importantly and lastingly, a bunch of friends.

Every now and then, I get a glimpse of just how lucky I’ve been over the last ten years, and the truly astonishing opportunities that have been available to me by virtue just being in the right place, and being willing to volunteer a little of my time.

I’ve been less involved for the last year, since there’s somewhere that my attention has needed to be focused. I’m gradually getting back into spending time on Apache things, but it’s given me some time to think about where I want to spend the few cycles that I have, and I expect that my involvement will be a little different from what it’s been in the past.

But time will tell.

APC

Add another one to the list of things that I’ve put off for a long time, only to realize that they’re simple to do, and have a great pay-off.

Today I installed and enabled APC, which immediately doubled the speed of my PHP applications. And, more importantly, the load on the server immediately dropped by a factor of 10.

I understand that there are other php caching accelerating thingies out there, and I expect that everyone has their opinion of which one is the best. But I’m very impressed with APC.

PHPiCalendar and PHP 5.2

Upgraded PHP to 5.2, and phpicalendar promptly broke. Silently. That is, I was getting the White Page Of Death, but no error messages, even on E_ALL.

The short form of the story is that by increasing memory_limit (it was set to 11M) the problem was solved. When PHP encounters the memory_limit, it simply bails silently, without logging any kind of error message. That’s unfortunate.

So it appears that under 5.0, phpicalendar was able to run without problem in 11M, but with 5.2, suddenly it requires more than that. Exactly how much more than that, I don’t know, and didn’t experiment a whole lot. Perhaps that’s a task for another day.

PHP|Tek

My flight ended up being delayed more than 5 hours. I think that the universe is trying to compensate for my trip to Amsterdam, and the balance of my karma is now restored. So hopefully there will be no karmic backlash in July. 🙂

I’m currently sitting in the keynote room waiting for Rasmus to arrive to give the Keynote. He’s always a good speaker, and I imagine this will be no exception, since he’s very much in his element here.

And … there he is.

PHP|Tek

Tomorrow I will be leaving for PHP|Tek, which will be the first PHP conference I’ve ever attended.

Over the last 3 years I have gone from being a Perl programmer, and maintaining multiple packages on CPAN, to being a PHP programmer in my day job, and involved in a PHP Open Source project in my spare time, and now I’m speaking at a PHP conference. This is quite a shift, although the biggest thing that I’ve found during that shift is that the two languages have a lot more in common than they have different – an observation which is received with cries of HERESY from both camps.

If you’re going to be in Chicago this week, give me a call.

Upcoming travels

In the last few days, I’ve received my itineraries for travels in May, and it’s suddenly seeming very close.

The last week of April I’ll be leaving for Apachecon in Amsterdam. I’m still frantically trying to get my tutorial notes done so that I can have them in by the deadline on Friday. I was dumb enough to submit a brand new tutorial for this ApacheCon, after giving the same tutorial every ApacheCon since 2000 in Orlando (with one exception – I was just so sick of it that I didn’t do it in Austin.) and now I have to actually prepare it. Just an enormous amount of time involved in putting together a half-day tutorial.

Two weeks after that, I’ll be speaking at PHP|Tek in Chicago – one of the few places in the world that I can fly to without changing planes. I’ve never been to a PHP conference before, and it’s a great honor to be asked. I’ll be giving my “intro to mod_rewrite” talk, and then I’ll get to hang out with all those cool PHP people for a few days. I’m really looking forward to that.

So, if you’re going to be in either Amsterdam or Chicago in May, do drop by and see me. And if you’re not, well, you should make plans to be. They’ll both be great conferences, and there will be interesting people there.

phptidy

Long, long ago, Steve Hancock gave us PerlTidy, which allowed me to quickly and reliably convert raw Perl code into code that abided by all of my coding standards, whatever they might be for a particular project. This was much goodness.

I even have a vim macro that allows me to select a block of text, type a key sequence, and have that code reformatted so that it is more easily readable, evenly indented, and just prettier.

For many years, I’ve looked for a similar tool for PHP. I’ve seen references to something that Coogle did, but I can’t actually find it, and it doesn’t completely sound like what I’m looking for anyways.

Apparently the problem is that the intermixing of form and function (html and php) that happens in php code, makes this a more difficult problem than just parsing and reassembling source code. I naively think that there must be a simple way to treat HTML as comments and ignore it, but seeing as I have not the vaguest idea of how to go about this, it’s kinda of condescending of me to make such claims. What do I know?

This morning I discovered that PerlTidy works, some of the time, to tidy up PHP code. And, of course, sometimes it doesn’t, because part of what PerlTidy does is inspect the Perl code itself, in order to determine how to format things, and PHP code doesn’t generally parse as valid Perl, except when it does.

When I was learning PHP, I observed repeatedly that it was almost exactly the same as Perl, in most respects, most of the time. This gained me many dirty looks from the “Perl is evil” PHP programmers I encountered, but, since language bigotry has never struck me as a survival strategy, I continue to maintain this belief. Indeed, this belief allowed me to uncover features of PHP that I don’t frequently see used, and aren’t very well documented, but I discovered blindly by assuming that PHP should behave the same as Perl if I need it to. And most of the time it does.

Ahem. Back to the point.

I find numerous postings on various blogs and mailing lists, where people are bemoaning the lack of a usable PHPTidy tool. I’m really curious why it’s a hard problem. I don’t understand what’s involved in doing this, in the least, either in PHP or Perl, so I have no real notion of whether it is hard or not. What gives?