How to install phpMyAdmin in centos 5.x

In this Section of tutorial you will learn How to install phpMyAdmin in centos 5.4? & How to rectify common installation errors.

First try to search package for PhpMyadmin by executing command "yum search phpMyAdmin"  ; if there is no showing phpMyAdmin packet we must install epel package.


• rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
• yum install phpmyadmin
• after installation visit to : http://192.168.1.1/phpMyAdmin/
• Edit the “root” user with password “password” on php my admin, then Login with username root and password “password”.
• Edit the phpmyadmin.conf ; on /etc/httpd/conf.d/phpMyAdmin.conf

You will see a lines like below, Comment Line deny from all
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
Directory /usr/share/phpMyAdmin/
order deny,allow
#deny from all
allow from 127.0.0.1
allow from 192.168.2.0/24
allow from ::1
/Directory


phpMyAdmin - Web based MySQL browser written in php
Allows only localhost by default
But allowing phpMyAdmin to anyone other than localhost should be considered
dangerous unless properly secured by SSL

• Edit the file ; /etc/phpMyAdmin/config.inc.php
vi /etc/phpMyAdmin/config.inc.php
• Edit the part of: insert the password
This is needed for cookie based authentication to encrypt password in cookie
/
$cfg['blowfish_secret'] = 'password'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH!
/
• And the part: change from “http” into “cookie”
$cfg['Servers'][$i]['auth_type'] = ‘cookie’; // Authentication method (( config, http or cookie based)?
• Restart Httpd Service
The error message in question looks like this:




phpMyAdmin - Error

Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.
Clearly there's something wrong with the way sessions are being used. I checked the Apache error log file and it didn't actually show any error messages and I don't have PHP logging errors separately.
The next step was to have a look at the php.ini file and see what the session settings are. This is on a CentOS 5 webserver with a default install. I've removed all the unecessary comments etc:
[Session]
session.save_handler = files
session.save_path = "/var/lib/php/session"
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor     = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
I couldn't see anything wrong there, so I figured the next logical step was to check the directory specified by the session.save_path option as follows:
ls -l /var/lib/php
total 2
drwxrwx--- 2 root apache 2048 Jul 17 11:56 session
That shows us that the session directory is owned by "root", the user is "apache" and it can be written to by both user and group but no one else. That all looks fine but we run this particular webserver as a user other than "apache".
It would therefore appear that when I did an upgrade of PHP a little while back it restored the user permissions back to root:apache instead of leaving them root:myusername (myusername isn't the actual username in question - just an example). I am making an assumption here because there shouldn't be any other reason for the permissions to have changed.
A simple chown is all that's required:
sudo chown -R root:admin /var/lib/php/session
and then the error in phpMyAdmin went away and we were able to log in again.
So, assuming I am correct that a PHP upgrade on CentOS restored the PHP session directory default permissions, if you run Apache on CentOS as a user other than "apache" you need to make sure you check the permissions of your PHP session directory after upgrading. This will affect any websites using PHP file based sessions, not just phpMyAdmin.

Comments

Popular posts from this blog

How To Add Print Button to Blogger Posts

INSTALL CISCO VPN CLIENT ON WINDOWS 10 (32 & 64 BIT). FIX REASON 442