Skip to main content

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

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

This article shows how correctly install Cisco VPN Client (32 & 64 bit) on Windows 10 (32 & 64 bit) using simple steps, overcome the ‘ This app can’t run on this PC ’ installation error , plus fix the Reason 442: Failed to enable Virtual Adapter error message . The article applies to New Windows 10 installations or Upgrades from earlier Windows versions and all versions before or after Windows 10 build 1511 .  To simplify the article, we’ve broken it into the following two sections: How to Install Cisco VPN client on Windows 10 (clean installation or upgrade from previous Windows), including Windows 10 build prior or after build 1511 . How to Fix Reason 442: Failed to enable Virtual Adapter on Windows 10 Figure 1. The Cisco VPN Client Reason 442: Failed to enable Virtual Adapter error on Windows 10 HOW TO INSTALL CISCO VPN CLIENT ON WINDOWS 10 (NEW INSTALLATIONS OR O/S UPGRADES) The instructions below are for new or clean Windows 10 inst...

Linux File and Directory Permissions

file & directory protection is a essential of any OS and Linux OS is no exception for it! These authorizations allow you to choose exactly who can access your files & directory, providing an overall improved system security. There was one of the major flaws in the older Windows operating-system where, by standard, all users can see each other people's information (Windows 95, 98, Me). For overcoming it, editions of the Windows based computer system such as NT, 2000, XP and 2003 lot more security features added. They fully support file & directory permissions, just as Linux system has since the beginning. Together, we'll now assess a directory listing from our Lab Linux system hosting server, to help us understand the information provided. a simple 'ls' command will give you the file and directory listing within a given directory, including the option  '-l' will display number of new areas that we are going to discuss here:

How to create a Hirens Boot CD 15.2 USB Disk

Hiren’s BootCD (HBCD) is a bootable CD that contains a set of tools that can help users to fix their computer if their system fails to boot. More specifically, HBCD contains hardware diagnostic programs, partition tools, data recovery utilities, antivirus tools and many other tools to fix your computer problems.  I write this article because I use Hiren’s BootCD frequently to troubleshoot computer problems, specially when a computer doesn’t boot anymore due to a virus attack or due to a corrupted file system. In this article you will find instructions on how to put Hiren’s BootCD on a USB flash drive (stick) in order to troubleshoot computer problems in the future.