Difference between revisions of "Adminer"

From ArchWiki
Jump to navigation Jump to search
(Removed "Install php-sqlite" -don't needed)
m (→‎Nginx: Fix missing tpl)
 
(28 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Category:Web server]]
+
[[Category:Web admin interfaces]]
[[cs:Adminer]]
 
 
[[ja:Adminer]]
 
[[ja:Adminer]]
[http://www.adminer.org/ Adminer] is a simple tool for database management. It's possible to manage [[MySQL]], [[PostgreSQL]], [[Sqlite3]], MS SQL and [[Oracle]].
+
[http://www.adminer.org/ 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's a simpler alternative to [[PhpMyAdmin]]. You can find more pieces of information about this project at the [http://www.adminer.org/en/ official page] or at [[Wikipedia:Adminer|Wikipedia]].
+
It is a simpler alternative to [[PhpMyAdmin]]. You can find more pieces of information about this project at the [http://www.adminer.org/en/ official page] or at [[Wikipedia:Adminer|Wikipedia]].
  
 
== Installation ==
 
== Installation ==
 +
[[Install]] the {{AUR|adminer}} package or [https://www.adminer.org/#download download Adminer] and place it manually in the document-root instead.
  
Ensure you do not have a manually downloaded copy of Adminer installed!
+
When using the {{AUR|adminer}} package, Adminer will be installed as {{ic|/usr/share/webapps/adminer/index.php}}.
  
[[Install]] {{AUR|adminer}} from the [[AUR]].
+
Ensure the correct extensions in {{ic|/etc/php/php.ini}} are uncommented, e.g. {{ic|1=extension=pdo_mysql}} should provide [[MySQL]] database management.
  
Adminer will be installed as {{ic|/usr/share/webapps/adminer/index.php}}.
+
== Configuration ==
  
Don't forget to enable {{ic|mysqli.so}} in your {{ic|/etc/php/php.ini}} by uncommenting following line:
+
=== Apache ===
  extension=mysqli.so
 
  
{{Warning|As of PHP 5.5, {{ic|mysql.so}} is [http://www.php.net/manual/de/migration55.deprecated.php deprecated] and will fill up your log files with error messages. It is no longer available in PHP 7.0.}}
+
Add the following line to {{ic| /etc/httpd/conf/httpd.conf}}:
 +
 
 +
Include conf/extra/httpd-adminer.conf
  
== Configuration under Apache ==
+
Then [[restart]] your [[apache]] daemon.
  
Add the following line to {{ic| /etc/httpd/conf/httpd.conf}}:
+
Adminer can now be accessed by browsing to [http://localhost/adminer http://localhost/adminer].
 +
 
 +
=== Nginx ===
 +
 
 +
{{Note|Ensure that the [[nginx#FastCGI|PHP FastCGI interface]] has been configured correctly.}}
 +
 
 +
Create a [[Nginx#Managing_server_entries|server entry]] using {{ic|/usr/share/webapps/adminer}} as {{ic|root}}:
 +
{{hc|/etc/nginx/sites-available/adminer.conf|<nowiki>
 +
server {
 +
    listen 443 ssl http2;
 +
    listen [::]:443 ssl http2;
  
Include conf/extra/httpd-adminer.conf
+
    server_name adminer.domain;
 +
    root /usr/share/webapps/adminer;
  
Then [[restart]] your [[apache]] daemon.  
+
    # Only allow certain IPs
# systemctl restart httpd
+
    #allow 192.168.1.0/24;
 +
    #deny all;
  
{{Note|The Adminer can be accessed by your browser on [http://localhost/adminer http://localhost/adminer].}}
+
    index index.php;
  
In case there is an (403) error, change the following lines inside the {{ic|/etc/httpd/conf/extra/httpd-adminer.conf}} file:
+
    location / {
Alias /adminer "/usr/share/webapps/adminer"
+
        try_files $uri $uri/ =404;
<Directory "/usr/share/webapps/adminer">
+
    }
      AllowOverride All
 
      Require all granted
 
      #php_admin_value open_basedir "/srv/:/tmp/:/usr/share/webapps/:/etc/webapps:/usr/share/pear/"
 
</Directory>
 
  
Restart the [[restart]] [[apache]] daemon again.  
+
    error_page 404 /index.php;
# systemctl restart httpd
 
  
== Configuration under Nginx ==
+
    # PHP configuration
 +
    location ~ \.php$ {
 +
      ...
 +
    }
 +
}
 +
</nowiki>}}
  
Ensure that the [[nginx#PHP configuration|php FastCGI interface]] is configured correct.
+
Symlink {{ic|adminer.conf}} to {{ic|sites-enabled}} and [[restart]] [[nginx]].
  
Then ad the folwing {{ic|server}} block to your {{ic|/etc/nginx/nginx.conf}} or place it in a file under {{ic|/etc/nginx/servers-available/}} and [[nginx#Managing server entries|enable]] it.
+
=== Hiawatha ===
  
Afterwards restart the server with {{ic|systemctl restart nginx.service}}.
+
Ensure that the [[Hiawatha#FastCGI|PHP FastCGI interface]] is configured correctly.
  
{{hc|/etc/nginx/nginx.conf|<nowiki>
+
Then add the following {{ic|VirtualHost}} block to your {{ic|/etc/hiawatha/hiawatha.conf}}.
server {
+
{{hc|head=/etc/hiawatha/hiawatha.conf|output=
        listen 80;
+
VirtualHost {
        server_name db.domainname.dom;
 
        root /usr/share/webapps/adminer;
 
  
        # If you want to use a .htpass file, uncomment the three following lines.
+
    # If you set WebsiteRoot to /usr/share/webapps/adminer you don't need followsymlinks
        #auth_basic "Admin-Area! Password needed!";
+
    # I symlinked the adminer folder to '/srv/http/adminer' so that I can easily remember where it's located but
        #auth_basic_user_file /usr/share/webapps/adminer/.htpass;
+
    # still set 'WebsiteRoot' to the real source directory. You could point WebsiteRoot to the
        #access_log /var/log/nginx/adminer-access.log;
+
    # symlinked directory, but you will have to set 'FollowSymlinks = yes' for that to function properly
  
        error_log /var/log/nginx/adminer-error.log;
+
    Hostname = db.domainname.dom
        location / {
+
    #FollowSymlinks = yes
                index index.php;
+
    #WebsiteRoot = /srv/http/adminer
                try_files $uri $uri/ /index.php?$args;
+
    WebsiteRoot = /usr/share/webapps/adminer
                }
+
    AccessLogfile = /var/log/hiawatha/adminer/access.log
 +
    ErrorLogfile = /var/log/hiawatha/adminer/error.log
 +
    StartFile = index.php
 +
    UseFastCGI = PHP7
  
location ~ .php$ {
 
        include fastcgi.conf;
 
        #fastcgi_pass localhost:9000;
 
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
 
        fastcgi_index index.php;
 
        fastcgi_param SCRIPT_FILENAME /usr/share/webapps/adminer$fastcgi_script_name;
 
        }
 
 
}
 
}
 +
}}
  
</nowiki>}}
+
Then [[restart]] the {{ic|hiawatha.service}}.
  
 
== See also ==
 
== See also ==

Latest revision as of 08:36, 17 October 2019

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