docker-adminer
docker-adminer copied to clipboard
Plugins are broken in docker image
The plugins are not working with the latest adminer:5.2.1-standalone image.
Enable the login-servers plugin using:
Dockerfile
FROM adminer:5.2.1-standalone
RUN cp /var/www/html/plugins/login-servers.php /var/www/html/plugins-enabled/
$ docker build -t adminer:dev .
$ docker run -it --rm -p 8080:8080 adminer:dev
Error:
GET /favicon.ico - Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, int given in /var/www/html/adminer.php:1142
Stack trace:
#0 /var/www/html/adminer.php(1142): method_exists(1, 'name')
#1 /var/www/html/index.php(30): Adminer\Plugins->__construct(Array)
#2 /var/www/html/index.php(53): docker\adminer_object()
#3 /var/www/html/adminer.php(1151): adminer_object()
#4 /var/www/html/index.php(56): require('/var/www/html/a...')
#5 {main}
thrown in /var/www/html/adminer.php on line 1142
The prior fix attempt didn't fix the problem: https://github.com/TimWolla/docker-adminer/issues/207
RUN cp /var/www/html/plugins/login-servers.php /var/www/html/plugins-enabled/
You are using it incorrectly. The files in plugins-enables/* are supposed to return a plugin object. By copying the plugin file you are not returning anything, which PHP will interpret as a return value of 1 and which then leads to this error message (which arguably can be improved).
login-servers is a plugin with a required parameter. Trying to load it via the environment variable will tell you how to use it:
Unable to load plugin file "login-servers", because it has required parameters: servers
Create a file "/var/www/html/plugins-enabled/login-servers.php" with the following contents to load the plugin:
<?php
require_once('plugins/login-servers.php');
/** Set supported servers
* @param array{server:string, driver:string}[] $servers [$description => ["server" => , "driver" => "server|pgsql|sqlite|..."]], note that the driver for MySQL is called 'server'
*/
return new AdminerLoginServers(
$servers = ???
);
Note the return new AdminerLoginServers().