Tag Archives: RedHat Linux

HTTPS in RHEL and PHP in less than 5 minutes !

Enabling HTTPS will give your application an added layer of security. The SSL layer will encrypt all communication that happens between the customer’s browser and your application. In this article, I am not describing things in detail about each security option. This is good enough to get started in most of the cases.

Login to Redhat Linux as user root and run the below commands to install apache ( with ssl support ) and PHP version 5.

#yum install httpd mod_ssl openssl php5
#service httpd restart

You should be able access your server via HTTPS now using the browser like https://yourservername.domain/application/login.php . You are now using a self signed certificate for the server. Your browsers might warn you about this , but it is safe to accept it and continue.

If your server was using HTTP only and you recently upgraded it to HTTPS, Here’s a quick and dirty method in PHP to detect if your users are still using HTTP and redirect them to HTTPS. All you need to do is include this code in the start of your php file.

< ?php
$loginURL="https://yourserver/application/login.php" ;
if($_SERVER['HTTPS']){
echo <<<REDIRECT
Redirecting to ... $loginURL 
<script>
window.location($loginURL);
</script>
REDIRECT;
}
?>

As you see, a little time spent can go great lengths towards securing your website and applications. Feel free to comment. 🙂

Hello Linux / Opensource

I got introduced to Gnu/Linux sometime back in 1999 when I was working as a computer hardware technician. Our customers were all using Windows 95/98/NT and we were supposed to install Windows and other applications after assembling the PCs. We were also handling customer support calls. One day, I got a copy of REDHAT Linux 6 from some pile of CDs we had at our assembling desk and I thought I would give it a try.

At first, it did look a bit confusing and there was no one to guide me. So I refered some documents I got from internet and went on installing the OS with all basic options. After a few days playing around with Linux desktop, I thought “Oh this does pretty much everything same as windows”. I started to dig out more information about this new OS and I realized that it is not really the desktop that I am seeing on the top. It was a pretty good software which allows me to do many other things which Windows could not do out of the box. As I continued my learning, my collegues were asking me what the hell I am doing with that PC in my free time. They were amazed to hear that this OS could accept the change of IP address without a reboot !

Many months passed and I was already very comfortable with Linux. I tried out different distibusions, I tried following the HOW-TO documents in the internet to set up my own webserver….

…years later, now my Linux skills are earning me respect among my tech-peers and a good pay cheque. I use and advertise Linux and Open source. I always ask my friends and collegues to switch to the Open Source software. If you have an absolute necessity to use a commercial closed source software, go ahead and use it. But if you could get the job done using the open source, why not? Trust me, it is not illegal to dump windows… 🙂