phpmyadmin on LEMP

You may want phpmyadmin on LEMP which is easier to use than mysql command line.

You need another vhost file symlink to /etc/nginx/sites-enabled as if phpmyadmin is another subdomain.

First of all get phpmyadmin sudo apt-get install phpmyadmin

Next find out where phpmyadmin is after the install, in my case for 8.04.1 it’s located at /usr/share/phpmyadmin folder.

cd into /etc/nginx/sites-available and sudo nano phpmyadmin

Paste below code to the file and save

server {
listen 80;
access_log /home/yourname/logs/phpmyadmin.access_log;
error_log /home/yourname/logs/phpmyadmin.error_log;

location / {
root /usr/share/phpmyadmin;
index index.php;

location ~ \.php$ {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
-> /usr/share/phpmyadmin$fastcgi_script_name;
include /etc/nginx/fastcgi_params;

You have to pay special attention to those underlined above and change to fit your particular case. The folders for the access_log and error_log must be there ready or else you’ll get error.

Symbolic link sudo ln -s /etc/nginx/sites-available/phpmyadmin
-> /etc/nginx/sites-enabled/phpmyadmin

Don’t forget that you need a CNAME DNS record for the sub-domain for phpmyadmin, in this case

Stop and restart nginx then point your browser to

Once you logged into phpmyadmin I noticed an error ‘can not load mcrypt extensions’. I have checked my php.ini file and the extension is there. According to the tips in this forum thread I have tried

sudo apt-get purge php5-mcrypt phpmyadmin
sudo apt-get install php5-mcrypt phpmyadmin

It’s still no good but otherwise phpmyadmin is working fine. [edited 2008.09.12: upon and server reboot the error is gone]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: