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. πŸ™‚

Weekend Project with OpenSource

Here’s another story about how open source helped me.

I have a USB disk at home where I store all my photos, videos, movies, songs etc.  The disk is connected to a desktop computer at home and shared across the network. Making it available on network helped me to backup my laptop data also to the disk using wireless connection. So far so good.

But what about watching movies or listening to songs or viewing pictures? I can do it from my laptop, but it will be only me. What’s the fun in that? I wanted to enjoy them with family and friends in my TV in the living room. Here’s how I did it.

In old Laptop, I installed PinGuy Linux (http://pinguy-os.sourceforge.net/ ) . I also updated all softwares to the latest version.

Now the problem is that I have a CRT TV. It supports only RCA input. My laptop had a  S-Video output. I bought a S-Video to RCA Cable and connected the laptop. It did not work !. Then I bought a VGA to RCA cable , that also failed. I did some research and ended up buying a VGA to RCA Converter box from the local electronics market. It gives 640×480 resolution that is probably the maximum my TV can do, anyways.. it worked.  πŸ™‚

Here’s the box.

So now, My TV shows only a part of the laptop screen because laptop is running at 1024×768 and TV can do only 640×480. Then I started XBMC , the Media Center Application. It gives a nice GUI to configure settings and also to manage the Media. I configured it to run in Window mode and dragged and re-sized the window to 640×480 resolution and placed it on the corner of the screen so that it covers fully what is shown on my TV.

Rest of the operation was simple, connected to my USB disk over network, added those files to XBMC. I also configured XBMC to show weather information and play Youtube videos.

I am now able to watch all my photos, videos and listen to songs in my USB disk via my TV. Hurray !

Wishlist :Infrared Remote for Laptop. Also a HD capable TV in future πŸ™‚

Firefox 4 Released

Firefox 4 is now available for download. Click here to see what’s new.

I installed it on my laptop. It has improved a lot. Specially the way tabs are organized and the visual layout overall has been totally streamlined. It is also loading webpages faster. Unlike the previous versions, Firefox 4 is using less RAM on my system.

So what are you waiting for? Give it a try. πŸ™‚

Performance review for Indians

Here is what I would rate from a totally negative manager’s point of view. I guess most of the people would agree with me.

People : We don’t care about others. Common mentality here is  “As long as my work is getting done, I will bribe, cheat, bend laws in order to get it”.  We want to know shortcuts for everything. We don’t like paying tips, but we do like receiving them. When we have problems, we will accuse the “system”. When they see a person is bleeding on the road, they will still walk away, after taking a picture on their mobile !.

Politicians :They are busy with securing a good future for themselves and their family. They have expertise in hiding money in foreign accounts. They go to USA for studying problems of people in India. Right will blame the left, and left will blame USA!

Media : They are supposed to report news as it happens. They will do anything but. dot.

Bureaucrats :They don’t consider people as people. For them, we are some worthless animals wasting their time. If you do not know any politicians or friends/relatives of these people, you have no voice, no choice but to bend your knees and lick their feet.

Managers : They think that we are slaves to them. Some of them even talk like they are the company, they will do good to their chamchas, they decide your future. What the heck.

Religions : They are busy in executing their agendas. Long time back they stopped reading what the Holy book ( be it Gita, Bible or Quran ) says. And even educated people are blindly following the blunders their leaders are making such as Jihad, Conversions etc.

Hospitals : No Doctor tells you the truth. You end up doing all kind of tests worth thousands even if what you have is just a fever. Medicines are sold at 200% profit . They might remove your Kidney when you go for doing surgery for appendicitis. Good luck.

Schools :Donations are sky high. We have different syllabus for different schools. So our children acquires different levels of knowledge  even though they are same age. Some get quality education and some end up getting nothing out of it even when they are going to school. Teachers are getting their jobs by paying bribes. How they will teach values to children?

As always, there are exceptions. Some people are there to help others, do their duty and work towards prosperity of everything. But unfortunately they are a rare breed and scarce to find.

Result : Improvement Needed.

P.S. : The common dialogue I hear regularly is “Why don’t you come to politics and improve it all ?” . Well my answer is : That does not mean that we cannot have an opinion. That’s just what I did now.  πŸ™‚

Libre Office – Free Yourself.

The Document Foundation is an independent self-governing meritocratic Foundation, created by leading members of the OpenOffice.org Community. After Oracle’s takeover of Sun, there has been a lot of discussion going on as to what would be the future of the Open Source Projects funded by Sun. Oracle has already shown that they are not so much into supporting Open Source projects. So I think this is definitely a good move.

I have downloaded it and installed on my computer. It is definitely faster and lot better in UI already. If you are still using OpenOffice, you could also consider migrating to LibreOffice. It uses the same code base and is already improved a lot than OpenOffice. May the freedom be with you ! πŸ™‚