Integrate Phpmyadmin & Nginx in Arch

Integrate Phpmyadmin & Nginx in Arch

Integrate Phpmyadmin & Nginx in Arch

No Comments on Integrate Phpmyadmin & Nginx in Arch

This time we will be trying to integrate Phpmyadmin with Nginx and MariaDB. We are using Arch Linux since its my preferred distribution, but all of these commands are not very specific to the distribution you choose to work with. PhpMyAdmin is one of the most famous tools for managing the MySQL database, and is included in most LAMP and LNMP stacks.
Simply replace the pacman commands with apt-get or similar. Check this very nice cheat sheet from the Arch wiki if you don’t know the equivalent commands for your system


To see which php tools you have available to your system, do a pacman search first. If you have followed my previous guide on how to install nginx in arch, then skip to the next step.

sudo pacman –Ss | grep php


This will show all available packages in your enabled repositories. Install the ones you will need for your specific projekt. In my case i will php7 and php-fpm7 and php-mcrypt.

php 7 (or 5.5)
php-fpm 72

To test if your mysql server is running correctly, try issuing this command in the terminal

mysql -u root -p


1) Installing phpmyadmin

If something like this shows up, this means that the SQL server should be running fine.  When everything is up and running its time to install Phpmyadmin. This command will install phpmyadmin and php-mcrypt.

pacman -S phpmyadmin php-mcrypt


Wait til everything is complete and then create a new symlink to these two folders. Notice the directory structure and be sure that what I write in my commands will fit with your structure. If this is a default installation, it should work with no problem.

sudo ln -s /usr/share/webapps/phpMyAdmin /usr/share/nginx/html


2) Configure PHP

After its done, use a text editor with root mode (sudo) and go to your php settings folder

sudo nano /etc/php/php.ini

Use “CTRL+W” to bring up the search panel, and look for “” and remove the sim-colon before the text. These are located all over the file, so have some patience and catch them all.
mysqli.allow_local_infile = On



mysqli.allow_local_infile = on

This is a default config file which includes the string option we need already, all we need to do is remove a sim-colon. Don’t close the editor just yet, using the locate tool (CTRL+W) again, look for a string called open_basedir make a newline, making sure not to uncomment the first one.

open_basedir= /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/

openBasedir configurePHP

3) Configure PHP-fpm

Since this is a followup on my previous blog post, lets configure php-fpm fastCGI to work with phpmyadmin.

First, make a backup of the folder (bettter safe than sorry) and changing the filename to .old

sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old

backup php config file

this image just shows that the backup was a success and we now have a file called nginx.conf.bak (or old, doesnt matter) Open up the original config file and replace the content with this:

#user html;
worker_processes 2;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/;

events {

worker_connections 1024;

http {

include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
charset koi8-r;
location / {
index index.php index.html index.htm;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
location /phpmyadmin {
rewrite ^/* /phpMyAdmin last;
error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
location ~ \.php$ {
#fastcgi_pass; (depending on your php-fpm socket configuration)
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
location ~ /\.ht {
deny all;



Save with “CTRL+O” and restart all the servers/services.

sudo systemctl restart php-fpm

sudo systemctl restart nginx


5) Test phpmyadmin

Go to your localhost and try it out

Localhost phpmyadmin


To make the changes system-wide. Enter these into the terminal, These should be enabled if you followed my previous tutorial, but if you are not sure, just replace enable with status and you can see if the services are running or not.

sudo systemctl enable php-fpm
sudo systemctl enable nginx
sudo systemctl enable mysqld

Martin Jørgensen

Martin Jørgensen

Got my degree from EAL in 2012 as an IT-Technologist with specialty in network. I enjoy living in a century where I can earn a living doing my hobby. Material I publish here are often part of my small projects.
Martin Jørgensen

Latest posts by Martin Jørgensen (see all)

Related Posts

Back to Top