Proper Way to Generate MD5 Hash for XCache Administration Password with md5sum or PHP

»»»Proper Way to Generate MD5 Hash for XCache Administration Password with md5sum or PHP

XCache is a PHP opcode cacher, more commonly known as PHP accelerator that speeds up PHP-based web pages serving and reduces web server load. XCache comes with a web-based administration page (admin-page) user interface that allows administrators or webmasters to monitor and operate the PHP opcode cache in the memory with the performance statistics. To use this admin-page, an user ID and password have to be defined in PHP.INI configuration file under xcache.admin.user and xcache.admin.pass parameter to authenticate the http-auth process.

For security purpose, password value entered in xcache.admin.pass has to be the MD5 hash. When user go to XCache admin-page, the http-auth will prompt to ask for user name and password credential. If the MD5 hash value for the password that user wants to use and assumed to be correct, is in fact a wrong one, then user will unable to login to the admin-page.

To generate the MD5 hashes for your desired password for XCache admin-page in PHP.INI, there are plenty of methods. The following two ways are some of the simplest way to get the password’s MD5 value without compromising security by transmitting password across network or Internet in plain text.

PHP Script

Create a new PHP script page on the webserver, and place the file within a website or virtual directory accessible from Internet:

<?php
echo md5("password");
?>

After saving the file with any name, request it from web browser using your domain name and get the MD5 hash value for your password, and update PHP.INI with the value.

md5sum

md5sum is a computer program which calculates and verifies MD5 hashes, and is installed by default in most Unix, Linux, and Unix-like operating systems or compatibility layers, including CentOS, the popular operating system for web hosts.

To generate MD5 hash value for the password using md5sum, the correct syntax is as follow:

echo -n "password" | md5sum

SSH to the server and run above command, the enter the value generate into PHP.INI.

In both cases, restart Apache web server after editing PHP.INI to make the changes effective.

By |2018-06-03T23:03:22+00:00June 3rd, 2018|Categories: Developer Tools|Tags: , |2 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.