Thunderbird and Firefox 10 in CentOS and RHEL

CentOS 6’s default repository still only has Firefox/Thunderbird version 3.1, and a lot of newer and greater versions has been released since then.

To begin with, make sure you have the older version of Firefox/Thunderbird installed. This is necessary, as we are going to use their launch scripts as a template to create the launch scripts for the newer version.

To shorten things up, I will refer to Thunderbird as TB, and Firefox as FF. For the most part, I will refer to TB instead of both TB and FF. All you have to do is change where I write ‘thunderbird’ to ‘firefox’ and it will most likely work. To begin with, you want to download the latest version of Thunderbird or Firefox.

  • 32 bit TB:
    wget 'http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/10.0-real/linux-i686/en-US/thunderbird-10.0.tar.bz2'
  • 64 bit TB:
    wget 'http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/10.0-real/linux-x86_64/en-US/thunderbird-10.0.tar.bz2'
  • 32 bit FF:
    wget 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/10.0/linux-i686/en-US/firefox-10.0.tar.bz2'
  • 64 bit FF:
    wget 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/10.0/linux-i686/en-US/firefox-10.0.tar.bz2'

Untar and unzip the file you just downloaded (as said before, name may vary with the product you are installing). Afterwards, delete the tar file, which is no longer necessary.

tar xf thunderbird-10.0.tar.bz2
rm -rf thunderbird-10.0.tar.bz2

The simplest way is to delete the current TB/FF install, and move the newly downloaded files to the old directory. This command will vary for 32 and 64 bit systems. IMPORTANT: For Firefox, change the number 3.1 to 3.6 for both architectures. As for the commands, for 32 bit:

rm -rf /usr/lib/thunderbird-3.1/*
mv thunderbird/* /usr/lib/thunderbird-3.1/

For 64 bit systems:

rm -rf /usr/lib64/thunderbird-3.1/*
mv thunderbird/* /usr/lib64/thunderbird-3.1/

Congratulations! You are more or less done. Now, you may want to get rid of the empty FF/TB folder by running the command:

rm -rf thunderbird

That’s pretty much all. Running command ‘thunderbird’ or going to ‘Applications -> Internet -> Thunderbird Email’ will launch the newly installed version!

Beyond TB/FF 10, the ‘automatic upgrade’ feature should kick in. As you can see in the two screenshots above, TB and FF will automatically look for new versions, and will automatically upgrade when they exist. This way, you can run much newer versions than those found in the CentOS/RHEL repo.

 

Using SOCKS Proxy in Firefox

Firefox can be configured to use various different types of proxies. To configure Firefox to use a SOCKS proxy, open the Firefox Preferences/Settings window. In Mac OS X, go to Firefox -> Preferences. In the Windows version of Firefox, go to Tools -> Options.

Go under the Advanced tab, and under the Network tab. From there, click on Settings.

Choose Manual proxy configuration. Leave everything empty except the SOCKS Host and Port. The SOCKS host and port should be the respective host and port.

HTML5 Upload Multiple Files to PHP

HTML5 provides us with the ability to upload multiple files with a single <input> element. While it has been possible to upload several files within one form field, users had to manually select the files one by one. With a few files that may not be an issue, but it will get tedious when uploading a larger number of files. Previously, it has been possible for web developers to implement a similar solution in Flash, but now it can be done natively with HTML5. Here is an example on how to get the <input> element to allow multiple files:

<form action="" method="post" enctype="multipart/form-data">
	<input name="uploads[]" type="file" multiple="multiple">
	<input type="submit" value="Upload!">
</form>

Note the name of the <input> is uploads[], with a bracket. While the bracket is not required for multiple file selection, it is required for PHP to process the files. The following PHP snippet can be used to process the files uploaded using the code above:

<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
	foreach($_FILES['uploads']['name'] as $id => $name) {
		rename($_FILES['uploads']['tmp_name'][$id], 'uploads/' . $name);
		echo "<p>$name uploaded successfully!</p>";
	}
}
?>

The PHP script will take all the files uploaded and place them into a folder named ‘uploads’. For it to work, the uploads folder will need to exist already, and needs to be writable by the web server. It’s recommended that you DO NOT use the exact PHP script in a production environment, as it’s dangerous to not check the file being uploaded. You don’t want others uploading a malicious PHP file and executing it on your server.