Skip to content

PHP PDO V2 CLA

PHP is a nice programming language for web applications with a large number of databases supported.

PDO is one of many database access abstractions trying to unify the way PHP talks to databases. Unlike most of these, PDO is written in C and not in PHP.

Wez Furlong wants to improve PDO "Version 2". In particular he and others want to produce an open spec that can be used by anybody including database vendors to code against, add unit testing for the spec and the drivers that claim to support it and improve metadata handling for PDO.

In order to get database vendors, notably IBM, into the game he proposes a Contributor License Agreement to make it easier for vendors to commit into the PDO part of PHP. There exist corporate and individual versions of the CLA, and the PDO license is yet another license that is different from the PHP license. Wez has prepared a FAQ covering questions regarding all that. Continue reading "PHP PDO V2 CLA"

Notes on VM

Even when it is being repeated once more it is not true:
Stripping binaries using the ‘strip’ utility can also significantly reduce the memory footprint of the application
claims John Coggeshall.

While it is true that a file is smaller on disk after a strip, a quick run of "size" on a binary will show you that the actual binary part of the file is unchanged. Let's have a quick look at /proc/pid/maps to understand what happens.
Continue reading "Notes on VM"

Statification

In Semi-Dynamic Data, Sheeri writes about Semi-Dynamic Data and content pregeneration. In her article, she suggests that for rarely changing data it is often adviseable to precompute the result pages and store them as static content. Sheeri is right: Nothing beats static content, not for speed and neither for reliability. But pregenerated pages can be a waste of system ressources when the number of possible pages is very large, or if most of the pregenerated pages are never hit.

An intermediate scenario may be a statification system and some clever caching logic.

Statification is the process of putting your content generation code into a 404 page handler and have that handler generate requested content. The idea is that on a second request the content will be there and thus a static file is being served with a 200 OK, using the fast path of the web server.

A typical example for this kind of task would be a script that generates its name as a PNG: By requesting http://vvv.k6p.de/statify/example.png, we are returning a PNG image that contains the text "example" - the number of potential PNGs is infinite, and we cannot possibly precalculate all of them. But a few PNGs are requested over and over - most likely because we are referencing them via some IMG tags in some HTML pages. It would be pointless to generate them again and again for each requester, because these images never change.

Here is how to do it, using PHP:
Continue reading "Statification"

Annotations to "Five Common PHP database problems"

In Five Common PHP database problems, Jack Herrington writes about
five common database problems that occur in PHP applications -- including database schema design, database access, and the business logic code that uses the database -- as well as their solutions


My experience in the field differs slightly from his observations, and so I thought a few annotations may be in order.
Continue reading "Annotations to "Five Common PHP database problems""

phpvikinger.org: Things that have no name

Right now I am in Skien, which is somewhere in the middle of the dark forests of Norway. Skien, a bustling town of a whopping 45.000 people is the seventh largest municipiality in Norway, and also the home of the PHP Vikinger Unconference.

My part on this Unconference was to hold a Nontalk, a session where I asked the audience to come up with things that they think are typical for Everyday PHP use and that currently do not have a name.

The following stuff are the slightly edited and commented notes I made in front of the audience while moderating our session.
Continue reading "phpvikinger.org: Things that have no name"

phpvikinger.org - an unconference

PHP is different. Unlike Java for example, there is no formal community, and no formal community process. PHP does not see itself as controlled by a company, or even large corporate players. PHP is not developed, it kind of grows. People using other languages see this as a weakness, but I actually think of it as a strength of the language, the platform and the community.

PHP is used differently than for example Java. Successful PHP projects use different strategies. If you have listened to what Rasmus has been telling you in his speeches during the last two years, you might get an idea of how PHP is different, and why. If you are comparing the approach MySQL has been using in the Dell DVD webshop benchmark uncontest with the other PHP approaches, you can see some of these principles applied.

Unfortunately, for many of these principles and methodologies no fancy names exist. So in my untalk on the PHP unconference at PHP Vikinger I invite you to describe the principles that you think make PHP different, and then we will try to find fancy names for them in order to be able to discuss them, and promote them.

I think this is important - nobody would have taken "put procedure call parameters into CGI parameters and just call them instead of building large XML requests to encapsulate everything" serious before it was called RESTful. And few people can understand Rasmus "scale by request and not by session, build lightweight and frameworkless pages and use the language and its modules as a framework instead of including tons of classes per request" before we can find a number of fancy acronyms for these things.

What else can you find that PHP does differently? Can you build cases for these patterns? And can you find good names for them?

MySQL UC: Upgrading to PHP 5 - Why and How?

Session by Laura Thomson.

Less than 7% of the sites currently using PHP are using PHP 5. Why is everybody skipping it?

PHP 5 has a few central cool features, and is much less incompatible than you may think. Try it. Watch out for the mysqli and PDO extensions and the new OO model. Also handy: Exceptions, Improved XML Handling, SOAP, Iterators and more.

Continue reading "MySQL UC: Upgrading to PHP 5 - Why and How?"