Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    6
    Thanks
    3
    Thanked 0 Times in 0 Posts

    SQLite + PHP - Call to undefined function sqlite_open()

    I have a SQLite database that I would like to access. I am running on a local WAMP installation.

    Apache Version :2.2.17
    PHP Version :5.3.5


    When I attempt to do this:


    Code:
    $dbhandle = sqlite_open('db/ledb.sqlite', 0666, $error);
    It throws an error:

    Code:
    Fatal error: Call to undefined function sqlite_open() in C:\wamp\www\php_test.php on line 3
    So I checked wether the server installation meets the requirements:
    http://www.php.net/manual/en/sqlite.installation.php

    And it appears to meet the requirements. It is a Windows build and the necessary ini values are enabled. Also full admin privileges.


    Any pointers on what is wrong here?
    (I worked with SQLite before but not in a php environment so I might be overlooking something important?)


    EDIT: The error was caused by not having properly activated the SQLite extension.

    However that produces a new issue:
    The database can not be accessed
    Code:
    Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is not a database in C:\wamp\www\php_test.php on line 3
    After looking at some topics there seems to be a version problem between the server that created the database and the machine trying to read from it. How do I fix that?
    Last edited by Jeffy; 09-13-2013 at 01:51 PM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Either you haven't restarted your services or you don't actually meet the requirements for the module. Check the httpd error logs for startup errors.
    Ensure the php_pdo_sqlite.dll is also enabled. I'm not 100% certain if that's required, but if the library requires PDO, and the PDO requires a driver, it would make sense to me that its enabled.
    There is also the sqlite3 and pdo libraries worth looking into. Since the sqlite library requires the PDO, you may as well just use the PDO. My understanding is there are significant improvements between sqlite and sqlite3, but I don't know if the sqlite is directly compatible with the PDO/sqlite3 classes.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •