phpMyAdmin on CentOS

May 30, 2013 37.6k views
Greetings, I'm stuck at installing phpMyAdmin, because it seems I do something wrong all the time. I have already installed LAMP and vsftpd+ftp on my droplet (CentOS 6.4). What should my next steps be? # yum install phpMyAdmin Doesn't work, as there is no such package. So I had to upload a .tar archieve with the latest version of phpMyAdmin to my FTP, uncompressed/copied the files over to /var/www/html/. Now is the question what next? I've been trying to make config files and access the GUI installer via web browser, but here is where I'm completely lost. Can anyone please write a step by step instruction on how to install the thing starting from this point? P.S. Also, how will my correct command look like to make a symbolic link for ./phpMyAdmin-VERSION-LANGUAGE/ -> ./phpMyAdmin/ ?
18 Answers
First of all, are you sure php is installed properly?

If so, this is how I do it.

Log into your command line and make sure you're in as root.

Go to your web directory

# cd /var/www/html/

Grab it down to your server

# wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.2/phpMyAdmin-4.0.2-all-languages.tar.gz


# tar -zxvf phpMyAdmin-4.0.2-all-languages.tar.gz

You'll end up with a directory /var/www/html/phpMyAdmin-4.0.2-all-languages so rename it

# mv phpMyAdmin-4.0.2-all-languages phpMyAdmin

Then change the permissions so Apache can execute.

# chmod -R 755 phpMyAdmin

Change directory and create a config file

# cd phpMyadmin

# mv config.sample.inc.php config.inc.php

Go in and edit anything if you need to, you probably won't.

Now you can go to http:///phpMyAdmin/index.php and log in.

If you are unable to log in, you might want to check if your php sessions are working OK. Check the php.ini file for session.save_path and make sure that path is writeable.

You can change your language on the login screen.
Thank you for the help. I have successfully installed it, seems working as intended.

There is another problem I'm currently trying to fix. Something is up to the module used to force Apache to change www path once there is a home directory/user created (mod_userdir.c). It was configured and is working well, but once I've had setup DNS with a new domain name this became impossible to access to some web folders. Example:
Where * - random public_html folders

http://ip/~username/* - works fine with any web folder
http://domain.com/~username/* - works fine
http://domain.com/* - nothing works of course

I know it's some kind of rerouting problem, but out of any ideas. What can it be? So basically I run both the Apache's root folder (and it shows the Welcome message on attempting to load http://domain.com/) and the user's home directory (I did it to simplify FTP managing) which works only with http://domain.com/~username/*. That's of course not the thing I want to see. Changing Apache primary directory breaks everything related to phpMyAdmin (as it's installed into /www/html/ and I don't want to trouble myself with "clear" website files from /home/~username/). It seems I need to set the primary dir to the username BUT everything in the Apache folder has to operate as well. I'm confused...

Note: Everything is configured and tested, so that only a problem with domain name resolving.
Excuse me for double post. Just poured some coffee inside to refresh my mind. Here I rephrase.

Literally I want it to work from 2 locations: /www/html/ and home/~username/. The biggest problem is that FTP was set to work with the user home folder and if I had set the Apache root html folder to this dir it would not work, since I have my phpMyAdmin installation in /www/html/.
So I figured:
1. Can it work from both dirs?
2. Can I move the html root to user home dir and create an alias/link to phpMyAdmin installation folder in the old Apache html folder (/www/html/)? So the website could work without a problem and such links like domain.com/phpMyAdmin will be carried out, too.
3. Move everything to the current Apache root folder (/www/html/) and forget about the users. But that creates more problems as FTP has to be reconfigured to be able to connect to that folder and it seems less secure, as the ROOT user will be used all the time.

Can you please help me to get through this. All the web is up and running, but this issue ruined my day.
You can move the phpmyadmin files to a directory under /home/user and point the VirtualHost DocumentRoot there so you can access it too via FTP.
Hey, thank you for the reply.

I did what I wanted. It was relatively easy, I just had to use Virtual Hosts and symlinks.
1. First, UserDir module was enabled.
2. A Virtual Host entry created for the whole website.
3. Created a link in userhome for phpMyAdmin which is located in /www/html/ folder.
Now everything works like a swiss watches. It also automatically redirects to phpMyAdmin from the link once it's in the directory folder I had set for VH/UserDir module (user root). So it's confirmed working and we go Live today.

Your help was greatly appreciated, people.
I'll be installing a mail server soon.
Glad to hear you got it working! :]
I have proceeded accordingly to the 1st reply phpmyadmin on apache and centos but when I visit the url http://domainname.com/phpMyAdmin/index.php I am not able to see anything it is giving error.. what could be the problem.. I am trying VPS for the first time.. please help me..
Thanks for the help in advance
@hypertextsol: Did you install a LAMP stack on your droplet? https://www.digitalocean.com/community/articles/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-6
by Etel Sverdlov
This tutorial explains how to install Apache, how to install MySQL, how to change the root MySQL password, how to install PHP, and how to see what libraries are available. LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache ( the web server) , MySQL (the database), and PHP (the language). This tutorial is written for Centos.
yes @kamal Naseer I have installed exactly as mentioned in that article (except the securing the ssh which was optional)
everything is running fine, except phpmyadmin
@hypertextsol What error do you get?
I followed these instructions and I'm getting a server error:

The website encountered an error while retrieving http://www.andyrench.com/phpMyAdmin/. It may be down for maintenance or configured incorrectly.
Error code: 500

I have the LAMP stack installed on my Centos droplet and it's working fine otherwise.

Any ideas?
@andy: Check Apache's error logs:

tail /var/log/httpd/error_log

Are there any errors?
Yes, there is:

PHP Fatal error: Call to undefined function mb_detect_encoding() in /var/www/html/phpMyAdmin/libraries/php-gettext/gettext.inc on line 177
Ah, got it working.

I ran 'sudo yum install php-mbstring'

I followed the steps exactly and still could not make phpmyadmin work.

Can anyone help me ?
@vignesh: Please create a new community question. Make sure you include all the commands you have run to install phpmyadmin.
Have another answer? Share your knowledge.