Skip to content

Instantly share code, notes, and snippets.

@dgleba
Created April 29, 2018 18:51
Show Gist options
  • Select an option

  • Save dgleba/4f5031dbd760e971844f277701f09338 to your computer and use it in GitHub Desktop.

Select an option

Save dgleba/4f5031dbd760e971844f277701f09338 to your computer and use it in GitHub Desktop.
Enable sqlite3 in Adminer
## Ensure System field is showing on the login form
Comment out `AdminerLoginServers` if it is present in the index.php
```
// new AdminerLoginServers([
// filter_input(INPUT_SERVER, 'HTTP_HOST') => filter_input(INPUT_SERVER, 'SERVER_NAME')
// ]),
```
## Create / edit index.php to enable plugins and enable the sqlite login plugin
```
<?php
# index.php
function adminer_object()
{
// Required to run any plugin.
include_once "./plugins/plugin.php";
// Plugins auto-loader.
foreach (glob("plugins/*.php") as $filename) {
include_once "./$filename";
}
// Specify enabled plugins here.
$plugins = [
// show / allow list of servers by commenting this out...
// new AdminerLoginServers([
// filter_input(INPUT_SERVER, 'HTTP_HOST') => filter_input(INPUT_SERVER, 'SERVER_NAME')
// ]),
// allow sqlite with login-sqlite plugin and selecting sqlite3 server type and put full path to sqlite database file in database field.
new AdminerLoginSqlite(),
];
return new AdminerPlugin($plugins);
}
// Include original Adminer or Adminer Editor.
include "./adminer.php";
```
## Edit the plugins/login-sqlite3.php
Get this file in place it in `plugins/`
`https://raw.github.com/vrana/adminer/master/plugins/login-sqlite.php`
Edit this line
`if (DRIVER != "sqlite" && DRIVER != "sqlite2") {`
to be
`if (DRIVER != "sqlite3" && DRIVER != "sqlite2") {`
## Select sqlite3 in the system field.
Select sqlite3.
## Fill in the Database field
Enter the full path to the sqlite file and press the login button.
## Done
You can now use adminer on that file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment