"There was a problem setting up your database"

Issue #162 resolved
Former user created an issue

Originally reported on Google Code with ID 162

What steps will reproduce the problem?
1.Log into php script for the first time, having set a folder or database array.

What is the expected output? What do you see instead?
Expected menu, received error!


What version of the product are you using? On what operating system? Which
Database Extension (PDO/SQLiteDatabase/SQLiteDatabase3 - see Database
structure-tab in phpLiteAdmin)?
1-9-3, Ubuntu 12.04, PDO (I think!)


Please provide any additional information below.

Below I will paste the exact output.  After receiving this error the first time, I
performed a
sudo apt-get install php5-sqlite
Which appears to have completed successfully.  Though my understanding is that I don't
need more than one?  I could very easily be overlooking something simple here.  I changed
the debug variable to true but did not receive additional output.

-----

There was a problem setting up your database, ../sqlite/notes2.db. An attempt will
be made to find out what's going on so you can fix the problem more easily.

Checking supported SQLite PHP extensions...

PDO: installed
SQLite3: not installed
SQLiteDatabase: not installed

...done.

The problem cannot be diagnosed properly. Please file an issue report at http://phpliteadmin.googlecode.com.

Reported by Rorosaurus on 2012-11-28 00:59:07

Comments (11)

  1. Former user Account Deleted
    After diving in a bit and echoing the exception, I found:
    
    exception 'PDOException' with message 'could not find driver' in /var/www/database/index.php:329
    Stack trace: #0 /var/www/database/index.php(329): PDO->__construct('sqlite:../sqlit...')
    #1 /var/www/database/index.php(1275): Database->__construct(Array) #2 {main}
    
    A bit more searching and I found that somehow, my php.ini file had "sqlite3.extension_dir"
    commented out.  I un-commented it, set it to the correct value, restarted apache, and
    things appear to be working properly now!
    

    Reported by Rorosaurus on 2012-11-28 01:41:28

  2. Christopher Kramer
    Thanks for reporting this issue.
    
    I think the problem is that having PDO installed does not necessarily mean PDO supports
    SQlite(3). The SQlite pdo-driver could simply be missing.
    
    I guess we should improve the check in this case.
    

    Reported by crazy4chrissi on 2012-11-28 10:52:57 - Status changed: Accepted

  3. Former user Account Deleted
    I had this same error, and in my case I had to uncomment the "extension=pdo_sqlite.so"
    and my sqlite3 database started working.  Running Arch Linux on a Raspberry Pi.
    

    Reported by RobinsonAaronD on 2012-12-13 02:50:48

  4. Former user Account Deleted
    I encountered the same problem, with the same error message. The error is due to the
    missing PHP SQLite library extension. I fixed it easily by installing the said extension
    on my kubuntu machine:
    sudo apt-get install php5-sqlite 
    The package name to install may slightly differ according to the distribution and the
    version. On a Debian/Ubuntu machine, one can search for the exact package name thus:
    apt-cache search sqlite php
    
    There is no actual bug in the code of phpliteadmin. The code properly reports the nature
    of the problem: the missing library. What could be improve, though, is the documentation.
    
    https://code.google.com/p/phpliteadmin/wiki/Installation
    I couldn't edit the wiki page above: there should be a section about how to install
    the library on various distributions (copy my instructions above for Debian/Ubuntu).
    
    
    The front page clearly signals the dependency but it also claims: " PHP version 5.3.0
    and greater comes with the SQLite3 extension installed and enabled by default so no
    custom action is necessary." This is not exactly correct. My php version is PHP 5.3.5-1ubuntu7.11
     and I did have to take action to manually install the appropriate package.
    
    The README.txt file distributed with the code could also be updated, at least to direct
    the users to the updated installation wiki page. Within README.txt, the REQUIREMENTS
    section should come before the INSTALLATION section. 
    
    The error message quoted by the OP could be improved a little: since it is established
    that the problem is a missing library, provide a link to the wiki page with the dependency
    installation instruction for each system. Instructions can be contributed by users,
    like I just did.
    
    I hope it helps.
    

    Reported by google@overshoot.tv on 2013-01-06 02:28:37

  5. Former user Account Deleted
    Thanks guys for such a good discussion. My problem also solve with the help of 
    "sudo apt-get install php5-sqlite"
    

    Reported by imranshaikh818 on 2013-05-13 07:13:05

  6. Former user Account Deleted
    As noted above: have the PDO class does not guarantee you have the driver / enabled
    the driver as well.
    
    I changed this check from:
    
            global $lang;
            $classPDO = class_exists("PDO");
            $classSQLite3 = class_exists("SQLite3");
            $classSQLiteDatabase = class_exists("SQLiteDatabase");
            if($classPDO)
    
    ...
    
    to
    
    ...
    
            if(class_exists("PDO")) // check if PDO is compiled in
            {   
                if(in_array("sqlite",PDO::getAvailableDrivers() ))
                    $modulesAvailable['PDO_sqlite'] = true;         
                if(in_array("sqlcipher",PDO::getAvailableDrivers() ))
                    $modulesAvailable['PDO_sqlcipher'] = true;  
            }
    
    
    
    so after checking the PDO exists, looking at which adapters are available.
    
    
    see the adaptions at : https://groups.google.com/forum/?fromgroups=#!topic/phpliteadmin/m48xOozopPo
    

    Reported by vincent1234567 on 2013-06-25 09:04:06

  7. Former user Account Deleted
    Hi, 
    
    Got the same error with Ubuntu 12.04 LTS. 
    Solved with
    
    $ sudo apt-get install php5 php5-sqlite php5-mysql
    $ sudo apt-get install php-pear php-apc php5-curl
    

    Reported by fabiomssilva on 2013-08-15 13:20:45

  8. Christopher Kramer
    I added a section about this to the installation wiki page (r437), and links to this
    page at several places and improved the check in phpliteadmin (now also checks the
    PDO SQLite driver) with r438 and improved the Readme.txt with r438.
    
    Can anybody with PDO but without the PDO SQLite driver confirm that the check works?
    

    Reported by crazy4chrissi on 2013-12-26 00:03:00 - Status changed: Started - Labels added: Type-Enhancement, Target-1.9.5 - Labels removed: Type-Defect

  9. Former user Account Deleted
    Thank you crazy4ch for the update. I visually checked your patches and they look good,
    although I have not tested them. My OS is obsolete and I cannot test removing/re-adding
    the necessary packages to test the patch. If by the time I upgrade my system (hopefully
    within a month or two) this issue is still open, I'll test it and report back. I made
    a note for myself to remember. Thanks. augustin.
    

    Reported by google@overshoot.tv on 2013-12-26 08:29:06

  10. Christopher Kramer
    This should be fixed with phpLiteAdmin 1.9.5 released yesterday.
    

    Reported by crazy4chrissi on 2014-01-15 09:42:36 - Status changed: Fixed

  11. Former user Account Deleted
    Yes the check of PDO without PDO SQLite driver works.
    

    Reported by gudul666 on 2014-08-26 08:32:51

  12. Log in to comment