Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Setting up a new machine, I just discovered the procedural interface to SQLite3 seems to be gone:

PHP Fatal error: Call to undefined function sqlite3_open()

Is there any way to get that back again? I tried Google now for a couple of hours, but found no suitable solution so far. If possible, I don't want to rewrite a bunch of code which worked fine until now (changing it may break it ;) -- so any hints as to how to restore that functionality is highly welcome!

share|improve this question

1 Answer 1

You can easily write a wrapper, then continue using your old functions. Example:

<?php

class MyDB extends SQLite3
{
  function __construct($filename)
  {
    $this->open($filename);
  }
}

if (!is_defined('sqlite3_open')) {
  function sqlite3_open($filename, $mode = 0666, &$error_message)
  {
    $db = new MyDB($filename);
  } 
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.