SourceForge has been redesigned. Learn more.

MDB2 v2.4.1 Support

  • Kevin Hatch

    Kevin Hatch - 2010-01-19

    Anyone installing PEM 2.5b with the newer MDB2 2.4.1 or later will need to make a few edits to the PEM code to account for the changes in variable handling that's occurred in MDB2. The manual fixes are outlined below. They are already present in the current development trunk, so all future releases will note require these changes.


    @line 480

    comment-out these lines:

       $statement = $pemdb->prepare($query, $types, MDB2_PREPARE_MANIP);
       $affected = $statement->execute($data);
       if (PEAR::isError($affected)) PEAR_error($affected);

    add these lines:

       $statement = $pemdb->query($query);
       if (PEAR::isError($statement)) PEAR_error($statement);

    @line 161

    replace these lines:

       $sql_prep = $pemdb->prepare($sql);
       if (PEAR::isError($sql_prep)) PEAR_error($sql_prep);
       $res = $sql_prep->execute($values);

    with these lines:

       if (empty($values))
          $res = $pemdb->query($sql);
          $sql_prep = $pemdb->prepare($sql);
          if (PEAR::isError($sql_prep)) PEAR_error($sql_prep);
          $res = $sql_prep->execute($values);


    @line 29


       $data = array("presenter_type" => $presenter_type, "internal_scheduled" => $internal_scheduled, "external_scheduled" => $external_scheduled, "internal_unscheduled" => $internal_unscheduled, "external_unscheduled" => $external_unscheduled, "status" => $status);


       $data = array("presenter_type" => $presenter_type, "internal_scheduled" => $internal_scheduled, "external_scheduled" => $external_scheduled, "internal_unscheduled" => $internal_unscheduled, "external_unscheduled" => $external_unscheduled, "status" => 1);


    @lines 193 and 197 (they are the same)


       $res = pem_exec_sql($query, $sql_values);


       $res = pem_exec_sql($query);
  • ozetrade

    ozetrade - 2010-04-26

    I have installed pem2.5b5 to a domain on a shared server.

    MDB2 2.4.1 MDB2_Driver_mysq 1.4.1
    PHP Version: 5.2.11 (Zend: 2.2.0)
    MySQL 5.0.89-community

    The installation script is failing with the error
    Fatal error: Call to undefined method MDB2_Error::fetchRow() in /home/MY_FOLDER/public_html/reservation/pem-includes/functions-db.php on line 58

    Any Help??

  • Kevin Hatch

    Kevin Hatch - 2010-04-26

    That error means MDB2 is not installed correctly/fully on your server, and PHP's not able to use the MDB2 functions as a result.  The shared server doesn't matter as long as all the packages are intact.  I don't know your server configuration, but given the error I'd go through reinstalls of PEAR and MDB2 to be sure they are set up right.

  • Kevin Hatch

    Kevin Hatch - 2010-04-26

    Also the beta 5 release of PEM has the above changes in this post built-in, so you don't need to change any of the code for MDB2 2.4.1 support.  This is an old thread.

  • ozetrade

    ozetrade - 2010-04-27

    Thanks for the prompt response. I did notice that the manual fixes had already been applied; I just figured that this thread was the most logical to post as it was MDB2 v2.4.1 Support.

    Fortunately my cPanel does allow me to install/uninstall PEAR modules, so I will gve that ago first.


  • Chris Nolan

    Chris Nolan - 2010-05-20

    I installed this today on a standard Centos 5.5 box and get exactly the same error as ozetrade:

    PHP Fatal error:  Call to undefined method MDB2_Error::fetchRow() in /my_path/pem2/pem-includes/functions-db.php on line 58

    PHP Pear and require modules are installed fine:

    php-pear 1.4.9
    php-pear-MDB2 2.4.1
    php-pear-MDB2-Driver-mysql 1.4.1

    PHP version is 5.1.6

    Any ideas? This seems strange, unless there are some other PEAR dependencies required?

  • Chris Nolan

    Chris Nolan - 2010-05-20

    I tracked this down somewhat and found a workaround.

    Workaround: I commented out the following line in ./pem-includes/pem-functions.php

    include_once ABSPATH . PEMINC . "/functions-auth.php";

    Then I ran through the install process - it will work but doesn't create the admin user. Then I uncommented that line and ran through the install process again, to force it to create the admin user. This works fine.

    I believe the error happens because somewhere in functions-auth.php it tries to query and use a WHERE clause that doesn't have a match in the db, because obviously the db is empty before it has been installed!

    I didn't track down the precise query, but this should give the devs something to go on.

  • Kevin Hatch

    Kevin Hatch - 2010-06-03

    That's strange.  The main development servers I've been using are Centos 5.4 with

    PHP 5.2.6
    PEAR 1.4.9
    MDB2 2.4.1
    MDB2_Driver_mysql 1.4.1

    That's nearly identical to your setup, and we're not running anything else special on the machines.  I have installed the server, PEAR, and MDB2 multiple times on different machines and the application worked fine each time, so I'm honestly not sure what I can do to make it easier with the current setup.   I used MDB2 to make it possible for more people to use the application, but if it's this problematic I may need to set MySQL as the default and MDB2 as a side option.  Do you have any thoughts on that?  MDB2 seemed fine at the time, but it's clearly been a problem for less-technical users too.

  • Tom

    Tom - 2010-09-11

    I got also a problem after installation and running the install-php (like mentioned in the documentation after creating of the pem-config.
    I got the error message: "Fatal error: Call to undefined method MDB2_Error::fetchRow() in D:\xampp\htdocs\pem\pem-includes\functions-db.php on line 58"

    I am using:
    - XAMPP 1.7.3 with
    - PHP Version 5.3.1
    - PEAR 1.9.0
    - mysql MDB2 driver       1.4.1
    - MDB2 2.4.1

    Yeah  -under Windows 7.

  • Kevin Hatch

    Kevin Hatch - 2010-09-12

    We've run more tests with the install on different servers, and the only time the "undefined method" comes up is if MDB2 is not installed fully/correctly.  Have you run any other MDB2 applications on your server, and do they work?  I'm hoping to get time on my schedule in the next couple weeks to finish the MySQL scripts; once that's done you will be able to use MySQL natively with the more complicated MDB2 as an optional backup for other database support.

  • Tom

    Tom - 2010-09-13

    Thanks for your answer.
    I tried it yesterday on a Ubuntu-Desktop-Version, MDB2 manually installed. I got the same answer. Hmm.
    I not using other MDB2 applications, sorry. Only native MYSQL things ;-)
    If you can finish this with native implementation of MYSQL it will be great - I think much more better ;-) Go for it!

  • Kevin Hatch

    Kevin Hatch - 2010-09-13

    The difficulty in configuring MDB2 with PHP is only half the problem.  In testing this with standard public hosts (like Dreamhost, etc.) I've also since found out that they don't/can't maintain their PEAR versions to the latest to insure backward compatibility.  So when you try to install MDB2 it will fail due to the older PEAR.  There's no way to easily fix the issue, so that's also causing incompatibility with general hosts.  The whole point of MDB2 was to increase compatibility via other databases, but since it's just made things worse, going back to the native MySQL by default is the only option.

  • Tom

    Tom - 2010-09-30

    And any news?
    I wanna test it - this projects looks very, very interesting for me. And (of course): I wanna test it as soon as possible.
    "going back to the native MYSQL" - how long it will take?
    Thanks for your answer - and go on with this interesting project!

  • Tom

    Tom - 2010-11-29

    any news? does it already run under native MYSQL????

  • Kevin Hatch

    Kevin Hatch - 2010-12-14

    I am sorry for the delay, it's been a busy few months with a move across the country, new job, etc.  I finally have some free time again this week, and the new MySQL-native version should be posted by the end of the week.

  • luke

    luke - 2010-12-14

    Wow! Perfect timing for me.  I was just about to abandon hope because of MDB2 thing on godaddy.  I am looking to get this running to evaluate for managing recording studios at our university.  Look forward to Mysql version!  I can't believe you just responded YESTERDAY.

  • luke

    luke - 2010-12-14

    Is there a demo install anywhere? :p

  • Kevin Hatch

    Kevin Hatch - 2010-12-16

    The best demo with real content can be seen here:  You can't view the admin side, but it's otherwise fully functional.  The SourceForge version of the application is different, as that's an earlier copy that's been customized for ICPL, but the look is essentially the same.

  • Tom

    Tom - 2011-02-04


    short question: Is the new MySQL-native version already available? Where? I am still waiting on it :-(
    Thanks for an answer.


Log in to post a comment.