informatique:serveur:web-linux-apache:installer-phpmyadmin

Installer phpMyAdmin

Prérequis :

  • PHP 7.4
  • Apache 2.4
  • MariaDB / MySQL 5.5 et plus

Les modules PHP mysql, zip, gd et mbstring sont nécessaires pour une utilisation optimale de l'application.

sudo apt install php7.4-mysql php7.4-mbstring php-zip php-gd

Télécharger l'archive présent sur le site phpmyadmin.net permet d'avoir la dernière version stable en date. A l'heure où j'écris ces lignes, il s'agit de la version 5.0.2.

  cd /var/www
  wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.tar.gz
  sudo tar -xzvf phpMyAdmin-5.0.2-all-languages.tar.gz
  sudo rm phpMyAdmin-5.0.2-all-languages.tar.gz
	cd phpMyAdmin-5.0.2-all-languages
	sudo chgrp -R www-data .
	sudo chmod -R g+s .

Configuration simple avec le fichier présent dans ``/var/html/phpMyAdmin-5.0.2-all-languages/config.inc.php``

<?php
// use here a value of your choice at least 32 chars long
$cfg['blowfish_secret'] = '1{dd0`<Q),5XP_:R9UK%%8\"EEcyH#{o';
 
$i=0;
$i++;
$cfg['Servers'][$i]['auth_type']     = 'cookie';
// if you insist on "root" having no password:
// $cfg['Servers'][$i]['AllowNoPassword'] = true;

configuration site avaible

  sudo nano /etc/apache2/sites-available/100-phpmyadmin.conf
Alias /phpmyadmin /var/www/phpMyAdmin-5.0.2-all-languages

<Directory /var/www/phpMyAdmin-5.0.2-all-languages>
    Options Indexes FollowSymLinks
    DirectoryIndex index.php

    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php

        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off
        php_value include_path .
    </IfModule>

</Directory>

# Authorize for setup
<Directory /var/www/phpMyAdmin-5.0.2-all-languages/setup>
    <IfModule mod_authn_file.c>
    AuthType Basic
    AuthName "phpMyAdmin Setup"
    AuthUserFile /etc/phpmyadmin/htpasswd.setup
    </IfModule>
    Require valid-user
</Directory>

# Disallow web access to directories that don't need it
<Directory /var/www/phpMyAdmin-5.0.2-all-languages/libraries>
    Order Deny,Allow
    Deny from All
</Directory>
<Directory /var/www/phpMyAdmin-5.0.2-all-languages/setup/lib>
    Order Deny,Allow
    Deny from All
</Directory>

Activer la configuration du site

  sudo a2ensite 100-phpmyadmin
  sudo systemctl reload apache2

Code intégral et interactif en cours de rédaction sur https://github.com/cedricAbonnel/server-web/scripts/install-phpmyadmin

  • informatique/serveur/web-linux-apache/installer-phpmyadmin.txt
  • Dernière modification : 2023/02/09 17:12
  • de Cédric ABONNEL