Chapter 33. Connecting PHP and PostgreSQL

You might find that MySQL or even simple text files meet all your data storage and retrieval requirements. Nothing about a simple flat data structure in a small quantity demands a relational database model. However, as we mentioned earlier in this book, you do have choices when it comes to databases. In the next chapter, we'll look at a commercial offering, Oracle. In this chapter, we'll look at what is possibly the granddaddy of the free/open source database alternatives, PostgreSQL (pronounced "post-gress-q-l" or sometimes "Postgrey").

Why Choose PostgreSQL?

This is the part where the open source purists start waving their hands in the air and yelling with uncontrolled excitement! And the excitement is easy to understand — PostgreSQL is a true open source database, made available under the simple and portable BSD license. You can read the almost vanishingly short text of the license at www.postgres.org/licence.html.

Are you back yet? See, we told you it was short. So reason number one is not so much the license itself as the freedom from an 85 page EULA laced with sneaky provisions that nobody alive really understands, and that, in many cases, you can't even see until you get the box open. By then it's too late — all the money's gone. Which brings us to reason number two: PostgreSQL is free. We don't mean "free on Mondays, Wednesdays, Fridays, and the vernal equinox," nor do we mean "free ...

Get PHP6 and MySQL® 6 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.