0

How can I check if sqlite2 is installed? Is it relatively easy?

Is it as simple as a 1 line check?

Jamesking56
  • 3,683
  • 5
  • 30
  • 61

2 Answers2

1

You can check with this code:

$sqlite = extension_loaded('sqlite');
if ($sqlite)
{
    echo 'SQLITE IS INSTALLED';
}

You can also check which version is installed:

$sqlite2 = extension_loaded('sqlite2');
$sqlite3 = extension_loaded('sqlite3');
if ($sqlite2 || $sqlite3)
{
    if ($sqlite2)
    {
     echo 'SQLITE2 IS INSTALLED';
    }

    if ($sqlite3)
    {
     echo 'SQLITE3 IS INSTALLED';
    }
} else
{
  echo 'SQL IS NOT INSTALLED';
}
Prid
  • 1,272
  • 16
  • 20
fiskolin
  • 1,421
  • 2
  • 17
  • 36
0
if(extension_loaded('sqlite')) {
  [ .... ]
}

If the sqlite extension is available, then you can proceed using it as you wish.

See also: http://php.net/extension_loaded

Matteo Tassinari
  • 18,121
  • 8
  • 60
  • 81