I'm not sure if my server has sqlite on it, so I want to use a PDO object to test and see if the server supports sqlite. I tried:
<?php
echo `sqlite3 -v`;
got the following error: Warning: shell_exec() has been disabled for security reasons
You could just use function_exists() to check if sqlite functions are present, like this:
if (function_exists('sqlite_open')) {
echo 'Sqlite PHP extension loaded';
}
For SQLite3
the former won't work, so use this instead (courtesy of Prid's comment):
if (class_exists('SQLite3')) {
echo 'SQLite3 extension loaded';
}
Or you can simply use :
if (extension_loaded('sqlite3')) {
// Do things
}
http://php.net/manual/en/function.extension-loaded.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With