Configuration of Phpmyadmin in Ubuntu 22.04

4 May 2018 webmaster

When installed via APT on Ubuntu, phpMyAdmin files are located in /usr/share/phpmyadmin, while configuration files reside in /etc/phpmyadmin/apache.conf. It is usually accessed via a browser at http://localhost/phpmyadmin or http://server-ip/phpmyadmin

In many cases, it's necessary to access the application from outside the PC where it's hosted. This requires reconfiguring the location, access settings, and firewall.

Follow these steps:

Modify phpMyAdmin access in the configuration file:

# Default Apache configuration for phpMyAdmin
Alias ​​/phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>

Options SymLinksIfOwnerMatch

DirectoryIndex index.php

# Limit libapache2-mod-php to the files and directories required for pma

<IfModule mod_php7.c>

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/tc>

</IfModule>

</Directory>

# Prevent web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>

Require all permissions
</Directory>
<Directory /usr/share/phpmyadmin/libraries>

Require all permissions

</Directory>

Add a shortcut in your web server's root directory for RAIS applications. For example: If you are located in /var/www/html

ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

Add a shortcut to the phpMyAdmin configuration file to navigate to the Apache configuration files folder.

ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf

Finally, enable the ports and access for phpMyAdmin to Apache and restart the Apache server:

a2enconf phpmyadmin.conf
ufw allow in "Apache Full"
systemctl restart apache2

 

 

Redirect to Facebook Page