Question

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

Is it as simple as a 1 line check?

Was it helpful?

Solution

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';
}

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top