How to install phpmyadmin in archlinux

Summary

Installing software in archlinux is usually simple. You can just type this command sudo pacman -S software and it will do the work. However, setting up phpmyadmin is not that easy.

Just follow this shot step by step.

Installing packages

First! open your terminal and type:

sudo pacman -S phpmyadmin apache php php-apache mariadb gedit

Note: gedit is optional, but install it so that you can follow along with me.

  • Press Enter

  • Enter your password

  • Type Y and wait for the installation to complete

Setting up PHP

Type this command in the terminal (or just copy paste):

sudo gedit /etc/php/php.ini

You will see something like this:

edit php

  • On your keyboard, press Ctrl+F and search for extension=mysqli

  • Remove the semicolon ; before extension=mysqli and extension=pdo_mysql, just like in the picture below

remove semicolon

  • Press Ctrl+F again, search for date.timezone, and give it a value, for example :

date.timezone = Europe/Berlin

date.timezone = Africa/Abidjan

You can find the capital of your country in this list

  • Search for display_errors by pressing Ctrl+F and make its value:
display_errors = On
  • Search for open_basedir and make its value:
open_basedir = /srv/http/:/var/www/:/home/:/tmp/:/var/tmp/:/var/cache/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/
  • Save and close
  • In your terminal, type this to edit httpd.conf:
sudo gedit /etc/httpd/conf/httpd.conf
  • Add this at the end:
### PHP Configuration
Include `conf/extra/php7_module.conf`:

3rd pic

  • Save and close

Setting up APACHE

  • Now, we will create a file called phpmyadmin.confby typing this command on the terminal:
sudo touch /etc/httpd/conf/extra/phpmyadmin.conf
  • Let’s open it by typing:
sudo gedit /etc/httpd/conf/extra/phpmyadmin.conf
  • Copy-paste this and save:
Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted
</Directory>

4 rth pic

Setting APACHE to use PHP (Using libphp)

  • In your terminal, type the following to edit httpd.conf:
sudo gedit /etc/httpd/conf/httpd.conf

Ctrl+F and search for LoadModule mpm_event_module modules/mod_mpm_event.so

  • Comment this line by adding a hashtag #, like this :
#LoadModule mpm_event_module modules/mod_mpm_event.so
  • Then, Ctrl+F and search for LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

  • Uncomment this line by removing the hashtag #, like this :

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Too much work? We will be done soon.

  • Paste this at the end of the LoadModule list, like what you see in the image below:
LoadModule php7_module modules/libphp7.so
AddHandler php7-script .php

fifth img

  • Paste this at the end of the text file:
# phpMyAdmin configuration
Include conf/extra/phpmyadmin.conf

before last

  • Save and close

Finishing up

Now, it’s almost done

  • Start apache with the following command:
sudo systemctl start httpd
  • Start mariadb with this command:
sudo systemctl start mariadb
  • Then, type the following in your terminal:
sudo mysql -u root -p 

Note: enter any password you want or just leave it empty by pressing Enter.

  • Finall,y set a password for the login dashbord:
SET PASSWORD FOR root@localhost=PASSWORD('2222');.
  • Open your favorite browser
http://localhost/phpmyadmin/ 

last

username: root 
password: 2222