Skip to content


PHPillow requires PHP 5.3

I started playing with PHPillow, a PHP wrapper for CouchDB. My intent was to use this to interact with CouchDB as it would handle all of the heavy lifting and allow me to focus exclusively on my application. I downloaded the source code, got it set up, and ran the speed_test.php script that they created. The first half executed successfully, creating 1000 documents and doing 5000 GETs on those documents. However, the script failed when trying to do a view, stating:
Fatal error: Call to undefined method phpillowUserView::user() in [...]/speed_test.php on line 56

After reading through the code for a bit I found that it was failing because the code utilizes some functionality that’s only available in PHP 5.3 (a development version) and I’m using PHP 5.2 (the latest stable version). There are several ways I could fix this:

  • Modify the code in speed_test.php (and anywhere else where I’d use similar code) to use PHP 5.2-style code. On the upside, it should be the most immediate way to fix it. However, I’ll need to do some learning because I have absolutely no idea what code I’d need to fix it now. And at some point PHP 5.3 will get released and I’ll want to go back and fix my code. Not a big issue, just more of a small annoyance.
  • Install PHP 5.3. Considering I’m already using two things that are in alpha (CouchDB and PHPillow), adding in a third is hardly a major concern at this point. This may actually end up being faster than modifying the code (sadly) because I just need to do some file/command-line wrangling instead of learning how to access PHPillow with PHP 5.2-style code.
  • Drop PHPillow and write my own classes/functions. I’m probably better off having someone else write the library for me though. Writing my own code might work as a short term solution to get me going now, but it’s likely a bad long-term solution.
  • Drop PHP and use another language to program my site. Considering the only other language I have some familiarity with is Python, this may not be the best idea. I’m better off expanding my knowledge of PHP rather than learning something brand new.

So option 4 is definitely out. And option 3 doesn’t seem very feasible if I want to make a lot of progress quickly; I’ll be bogged down trying to write new code to interact with CouchDB all the time. If I had more time I’d go with a hybrid of the first two options. That is, I’d figure out how the code should be written in PHP 5.2 to expand my knowledge but install PHP 5.3 to future-proof myself. Instead I’ll go with the faster option 2, install PHP 5.3 and be done with it.

I should mention another option, which would be the open source way of doing this. I could add/modify code in PHPillow to make it work with PHP 5.2. Some of their code already works with it, so it’s clearly possible. Someone just needs to invest the time to make it happen. Unfortunately that person is not me. I don’t have the programming skill to pull off that kind of thing yet.

Posted in development.

Tagged with .


2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Patrick says

    It’s possible to use it with php 5.2

    Replace some static call with direct class/function
    // replace : phpillowUserView::user(method,params) with..
    $user = new phpillowUserView();
    $user->query(‘user’, array( ‘key’ => ‘kore_0′ ));

    speed_test work with this…

  2. Scott says

    Thanks Patrick! Yeah, I saw that at least part of the speed_test was working with 5.2, but I didn’t dive further in to determine why the rest of it wouldn’t. I’ll have to try out your suggestion sometime.



Some HTML is OK

or, reply to this post via trackback.