Installation
phpMyAdmin gives you a web-based UI to interact with the MariaDB server. phpMyAdmin is no longer offered in the default Debian 10 repositories as of this writing, so we'll need to install it from source.
First, we'll need to install some required PHP modules:
Code: Select all
sudo apt-get install php-mbstring php-zip php-gd
Next, we need to download the latest phpMyAdmin release from the phpMyAdmin Download Page.
Navigate to the list of available downloads and find the most recent version of phpMyAdmin ending in "tar.gz", then right-click on that link and copy the URL. The most recent version as of this writing is 4.9.4. You can use the all-languages or english only version, whichever you prefer.
Now, we'll download this version to the server using wget, replacing the URL with the one you've copied:
Code: Select all
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.4/phpMyAdmin-4.9.4-all-languages.tar.gz
Code: Select all
tar xvf phpMyAdmin-4.9.4-all-languages.tar.gz
Code: Select all
sudo mv phpMyAdmin-4.9.4-all-languages/ /usr/share/phpmyadmin
Code: Select all
sudo mkdir -p /var/lib/phpmyadmin/tmp
Code: Select all
sudo chown -R www-data:www-data /usr/share/phpmyadmin
sudo chown -R www-data:www-data /var/lib/phpmyadmin
phpMyAdmin Configuration
Create a configuration file by copying the default sample configuration file included with the installation files:
Code: Select all
sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
Code: Select all
sudo nano /usr/share/phpmyadmin/config.inc.php
Code: Select all
$cfg['blowfish_secret'] = '';
Code: Select all
$cfg['blowfish_secret'] = 'm7WSudFRSW8VEv4otwLzfNho55pBnmpD';
Apache Configuration
Create a phpmyadmin.conf file in the /etc/apache2/conf-available/ directory:
Code: Select all
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Code: Select all
# phpMyAdmin default Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
<IfModule mod_php5.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
php_admin_value mbstring.func_overload 0
</IfModule>
<IfModule mod_php.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/
php_admin_value mbstring.func_overload 0
</IfModule>
</Directory>
# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
<IfModule mod_authz_core.c>
<IfModule mod_authn_file.c>
AuthType Basic
AuthName "phpMyAdmin Setup"
AuthUserFile /etc/phpmyadmin/htpasswd.setup
</IfModule>
Require valid-user
</IfModule>
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Require all denied
</Directory>
Next, enable the file for use with Apache using the command:
Code: Select all
sudo a2enconf phpmyadmin.conf
Code: Select all
sudo systemctl reload apache2