Solar System

In the spirit of some other framework projects, the Solar Framework for PHP 5 now offers a ready-to-use Solar system to get new users off to a quick start. It’s not prepared as a tarball just yet, but it is available for checkout or export using Subversion from

For example, if you make a checkout in your document root …

$ cd /var/www/html
$ svn checkout solar

… and follow the README instructions, you will have a fully-operational installation in very short order, including an SQLite database, authentication, and three example applications:
A simple “hello world”
A complex “hello world” with authentication and localization
A “bookmarks” application.

(Note that the “index.php” is only in the evaluation deployment; when you create a virtual host and point it at the Solar system document root, a .htaccess file makes the “index.php” unnecessary.)

You can read more about the structure and principles of the Solar system here.


Several developers have asked me what “BREAD” means in web applications. Most everyone knows that CRUD is “create, read, update, delete,” but I think that misses an important aspect of web apps: the listing of records to select from.

I don’t recall where I first heard the term BREAD; it stands for “browse, read, edit, add, delete”. That covers more of what common web apps do, including the record listings. It even sounds nicer: “crud” is something icky, but “bread” is warm and fulfilling. That’s why I tend to use the term BREAD instead of CRUD, especially when it comes to Solar and action-method names in the application logic.

Update 1 (2008-08-21): Wow, lot of traffic from Reddit and Y-Combinator on this one. Be sure to check out my post on Web Framework Benchmarking, and of course the Solar Framework for PHP 5.

I see a couple of comments saying that “browse is the same thing as read, it’s just a special-case of read.” I can see where that would be true, in a limited way. Using similar logic, one could argue that “add” is a special case of “edit”, it just happens that the record isn’t there yet; and then “delete” is another special case of “edit”, you’re just editing it out of existence. So that leaves you with just Read (one/many) and Edit (existing/non-existing/out-of-existence).

I think that takes things way too far. 😉 The special cases of “edit” are *so* special that they deserve their own logic. I think the same thing applies to “browse” — it might be a special case of “read”, but it’s different-enough to deserve its own place.

Update 2: Matthew Weier O’Phinney refreshes my memory — he mentioned the term to me years ago in a discussion about his PHP port of CGI::App. Thanks, Matthew!

Update 3: I said above that you could reduce all operations to “read” (with 2 cases) and “edit” (with 3 cases). It occurs to me now that those correspond to the way GET and POST are most-widely used. So maybe it wasn’t such a silly argument after all. 😉

Savant Has A New Owner

As many of you know, I’ve been the lead of many different PHP libraries over the years: Contact_Vcard_Parse, Contact_Vcard_Build, DB_Table, Text_Wiki, and others. As each matured, I handed them over to other maintainers who continued to improve on them and take them to greater heights. Now that time has come for Savant, one of my early and favorite PHP projects.

Due to time constraints, mostly because of my Solar framework project, I haven’t been able to pay as much attention to Savant as I think it deserves, so I made the hard decision to put it up for adoption. Lucky for the Savant community, Brett Bieber (aka Salty Beagle) of the PEAR Group picked up on that call right away. Brett is now the steward and lead developer of the Savant Template System for PHP.

The transfer of code, domain names, and hosting is complete, but the transition period might be a bit bumpy, so please bear with us. Brett is committed to “carrying the torch” for Savant (his words). Anyone who wants to help out the new project lead can contact him at “brett.bieber –at– gmail –dot– com”.

Thanks, Brett, for taking over the project, and good luck!

Exceptional command-line PHP

(Yes, I know, I’ve done no blogging in far too long. I’ve got a stack of stuff to blog about, but it’s all rather heavy. In the mean time, here’s something light.)

When executing code at the command line using php -r and PHP 5.2.5, be sure not to extend the Exception class. It will cause a segmentation fault.

For example, the following causes no trouble at all:

Samurai:~ pmjones$ php -r "throw new Exception();"
PHP Fatal error:  Uncaught exception 'Exception' in Command line code:1
Stack trace:
#0 {main}
  thrown in Command line code on line 1

But the next example gives a segmentation fault following a long … pause … after the stack trace output:

Samurai:~ pmjones$ php -r "class Foo extends Exception {} throw new Exception();"
Fatal error: Uncaught exception 'Exception' in Command line code:1
Stack trace:
#0 {main}
  thrown in Command line code on line 1
Segmentation fault

Note that we didn’t even throw the extended Foo exception; we threw the native PHP exception. The mere presence of the extended class is enough to cause the segfault.

It took me two evenings to track this down; what you see here is the simplified generic case. I’ve entered a bug with the PHP guys here.

Update: I thought I was running 5.2.6, but I was wrong; this was occurring on PHP 5.2.5. Note to self: check to make sure you’re running the latest version. 🙂

Update (2008-08-12): These guys found the problem earlier, too: