Adminer

From ArchWiki
Jump to navigation Jump to search

Adminer is a web-based database management tool written in PHP. It is possible to manage MySQL, PostgreSQL, Sqlite3, MS SQL, Oracle and Elasticsearch.

It is a simpler alternative to PhpMyAdmin. You can find more pieces of information about this project at the official page or at Wikipedia.

Installation

Install the adminerAUR package or download Adminer and place it manually in the document-root instead.

When using the adminerAUR package, Adminer will be installed as /usr/share/webapps/adminer/index.php.

Ensure the correct extensions in /etc/php/php.ini are uncommented, e.g. extension=pdo_mysql should provide MySQL database management.

Configuration

Apache

Add the following line to /etc/httpd/conf/httpd.conf:

Include conf/extra/httpd-adminer.conf

Then restart your apache daemon.

Adminer can now be accessed by browsing to http://localhost/adminer.

Nginx

Note: Ensure that the PHP FastCGI interface has been configured correctly.

Create a server entry using /usr/share/webapps/adminer as root:

/etc/nginx/sites-available/adminer.conf
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name adminer.domain;
    root /usr/share/webapps/adminer;

    # Only allow certain IPs 
    #allow 192.168.1.0/24;
    #deny all;

    index index.php;

    location / {
        try_files $uri $uri/ =404;
    }

    error_page 404 /index.php;

    # PHP configuration
    location ~ \.php$ {
      ...
    }
}

Symlink adminer.conf to sites-enabled and restart nginx.

Hiawatha

Ensure that the PHP FastCGI interface is configured correctly.

Then add the following VirtualHost block to your /etc/hiawatha/hiawatha.conf.

/etc/hiawatha/hiawatha.conf
VirtualHost {

    # If you set WebsiteRoot to /usr/share/webapps/adminer you don't need followsymlinks
    # I symlinked the adminer folder to '/srv/http/adminer' so that I can easily remember where it's located but
    # still set 'WebsiteRoot' to the real source directory. You could point WebsiteRoot to the
    # symlinked directory, but you will have to set 'FollowSymlinks = yes' for that to function properly

    Hostname = db.domainname.dom
    #FollowSymlinks = yes
    #WebsiteRoot = /srv/http/adminer
    WebsiteRoot = /usr/share/webapps/adminer
    AccessLogfile = /var/log/hiawatha/adminer/access.log
    ErrorLogfile = /var/log/hiawatha/adminer/error.log
    StartFile = index.php
    UseFastCGI = PHP7

}

Then restart the hiawatha.service.

See also