Author: hasin

I would love to be a baby sitter

Well, it may sound funny but this is what I want to be after 6 years. I am quite planned about my future and I will definitely retire from my regular web app dev job after 6 years. Beside this I love kids, love talking to them and love to see them growing up 😀

so I am going to be a baby sitter after 6 yrs and I am sure, I will do good 😀

WorldTimeEngine – How about making your own in PHP?

I recently came by this site WorldTimeEngine where users can search the local time of any place using the name, street address or just latitude and longitude. Since that time I was thinking how easily you can make your own. As long there are some good people over there (For Geocoding API) – its a not a big deal, you know? Lets have a look at the following PHP code.


<?
$place = "Bucharest";

$geodata = getGeoCode($place);
print_r($geodata);
echo getTime($geodata['lat'],$geodata['lng']);

function getTime($lat, $lng)
{
$url = "http://ws.geonames.org/timezone?lat={$lat}&lng={$lng}";
$timedata = file_get_contents($url);
$sxml = simplexml_load_string($timedata);
return $sxml->timezone->time;
}
function getGeoCode($address)
{
$_url = 'http://api.local.yahoo.com/MapsService/V1/geocode';
$_url .= sprintf('?appid=%s&location=%s',"orchid_geocode",rawurlencode($address));
$_result = false;
if($_result = file_get_contents($_url)) {
preg_match('!<Latitude>(.*)</Latitude><Longitude>(.*)</Longitude>!U', $_result, $_match);
$lng = $_match[2];
$lat = $_match[1];
return array("lat"=>$lat,"lng"=>$lng,"address"=>$address);
}
else
return false;
}
?>

Changing the variable “$place” to “Bucharest”,”Dhaka”, “Toronto” and “Oslo” gives me the following result


Array
(
[lat] => 44.434200
[lng] => 26.102955
[address] => Bucharest
)
2008-03-01 08:41

Array
(
[lat] => 23.709801
[lng] => 90.407112
[address] => Dhaka
)
2008-03-01 12:42

Array
(
[lat] => 43.648565
[lng] => -79.385329
[address] => Toronto
)
2008-03-01 01:42

Array
(
[lat] => 59.912280
[lng] => 10.749980
[address] => Oslo
)
2008-03-01 07:43

Nice, Huh?

29th Feb, 2012

What will happen this day in 2012?

Afif will be almost 6yrs old
His sister will be 3 yrs old
I will code in PHP10 and Python 5
I will still be young like today
I will hold a MySQL DBA Cert
I will be writing a book on Python
I will be having a car
No one in my family will be using windows anymore
I will write a blog post titled “29th Feb, 2016”
I will still be singing “Like a rolling stone”

And Finally

I will be preparing more for the self retirement in 2015

Getting Dell BCM4328 Wifi Card Working on Ubuntu 7.10

After trying,searching and crying for more than one month, I finally get it working today in my laptop (Dell Inspiron 6400) 🙂 – I am one of the happiest ever in this world right now :D. here’s how to. All the credit goes to “kayvortex

Model of my wifi card is “Broadcom BCM4328 802.11a/b/g/n (rev 01)”

Steps

1. Install Ndiswrapper Common and Ndiswrapper Utils (You can do it using synaptic)
2. Download The Driver from ftp://ftp.dell.com/network/R151517.EXE and unzip it somewhere. You will see a folder named DRIVER
3. Execute the following commands


sudo ndiswrapper -i /download_directory/DRIVER/bcmwl5.inf
sudo ndiswrapper -l
sudo modprobe ndiswrapper

4. Then, set ndiswrapper to load on startup:

sudo ndiswrapper -m
gksudo gedit /etc/modules

and add the following module to the list


ndiswrapper

5. Restart (This is a must)

Now you can use Fn+F2 to turn on your wifi 😀 )

Virutal Interview, Are you interested?

I can do one thing to help you out there 🙂 – if you are confident on PHP, JS and web application development – or if you want to see how a real interview actually takes place, I can take your interview for 30 minutes. You can just hide your name, designations if you want. I wouldn’t ask your real name or any private info for sure. I can send you the report right after your interview and using that you can understand where do you lack.

If you are interested for a 30 minutes interview over messenger – drop me a mail to [email protected]. Please note that you can hide your id for sure. I am sure it will help you to upgrade yourself (myself too :D)

On the way back to Dhaka – Seminar on "Current Job Trends"

Right now I am in the train on the way back to Dhaka. Got some free minutes in hand to write a post focusing things happened this week.

Last couple of days were simply awesome. I came to Rajshahi to present a seminar on “Current Job Trends” in “Rajshahi University of Engineering and Technology (RUET)” to help students to get a basic overview of current job market. Beside that I also focussed to the thngs they should be prepared before going to interview. To describe the overall feedback – it was amazing. I was surprised by their engagement and enthusiasm. It seems like they were waiting for such a seminar for a long time. Special thanks goes to faculty of computer science and engineering for arranging that. Professor Dr. Shahiduzzaman helped a lot to make it happen. Definitely thanks also goes to Sarwar Sattar (Stalin) and Murad, faculty of the department for their incredible help. Rana (05 CSE) – thank you too.

Seminar

You can download the slides from here http://javapark.net/hasin/RecentJobTrends.pdf.tar.gz

The seminar went great (well, I am saying ‘great’ based on the feedback I’ve got) – I will soon post some pictures of this seminar. After the end of this seminar, Professor Dr. Shahiduzzaman invited me to attend the farewell program of 03 batch. I feel honored to be invited in such a program. And I didnt miss the chance.

Beside these official programs, I also went to Naogaon to visit the house of my in-laws parents. The reception was beyond my imagination. I always like this cordiality of village peoples. Thats why I want to spend my life after 35 in such a place.

I will try to arrange such seminars in different universities to increase the awareness.

Unexpected return value from Facebook FQL.query via PHP REST Lib

While working with FQL I suddenly found a bug in one of our applications. The method which we used to count number of friends of a specific user who has added that application was returning 1 when there is no friend actually installed itāĨ¤ Using the following FQL you can easily find that. (FQL doesn’t support “count” – so you cant use it)

SELECT uid FROM user WHERE has_added_app = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = {$userid})

The PHP code may look like the following one

function getTotalFriends($userid)
{
global $facebook, $mysql;
$Users = $facebook->api_client->fql_query("SELECT uid FROM user WHERE has_added_app = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = {$userid})");
$NumberOfUsers = count(trim($Users));
return $NumberOfUsers;
}

So what would you expect when there is no friend who has added this application? Definitely the FQL query should return an empty array. So that counting elements of that array tells you that you have “0” friends. But actually it returns a white space. What’s the difference between an empty array and a white space? l

count(array()) returns 0
count (” “) returns 1

So even when you dont have any friends, your method actually returns you “1”. The return result is not expected. What does your common sense says? Either the method should return false or an empty array. Not a white space.

Here’s the correction


function getTotalFriends($userid)
{
global $facebook, $mysql;
$Users = $facebook->api_client->fql_query("SELECT uid FROM user WHERE has_added_app = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = {$userid})");
$NumberOfUsers = is_array($Users)?count($Users):0;
return $NumberOfUsers;
}

āĻ‰āĻ‡āĻ¨ā§āĻĄā§‹āĻœ āĻ›āĻžā§œāĻž āĻāĻ• āĻŽāĻžāĻ¸+

āĻ†āĻŽāĻŋ āĻāĻ‡ āĻŦāĻ›āĻ°ā§‡āĻ° āĻāĻ•āĻĻāĻŽ āĻļā§āĻ°ā§āĻ¤ā§‡ āĻ†āĻŽāĻžāĻ° āĻ˛ā§āĻ¯āĻžāĻĒāĻŸāĻĒ āĻĨā§‡āĻ•ā§‡ āĻ‰āĻ‡āĻ¨ā§āĻĄā§‹āĻœā§‡āĻ° āĻļā§‡āĻˇ āĻšāĻŋāĻšā§āĻ¨āĻŸāĻŋāĻ“ āĻŽā§āĻ›ā§‡ āĻĢā§‡āĻ˛ā§‡āĻ›āĻŋāĨ¤ āĻŦā§‡āĻļ āĻ…āĻ¨ā§‡āĻ•āĻĻāĻŋāĻ¨ āĻŽā§āĻ¯āĻžāĻ¨āĻĄā§āĻ°āĻŋāĻ­āĻž āĻŦā§āĻ¯āĻŦ‌āĻšāĻžāĻ° āĻ•āĻ°āĻžāĻ° āĻĒāĻ° āĻŽāĻ¨ā§‡ āĻšāĻ˛ āĻ…āĻ¨ā§āĻ¯āĻ•āĻŋāĻ›ā§ āĻŸā§āĻ°āĻžāĻ‡ āĻ•āĻ°ā§‡ āĻĻā§‡āĻ–āĻž āĻ¯ā§‡āĻ¤ā§‡ āĻĒāĻžāĻ°ā§‡āĨ¤ āĻ‰āĻŦā§āĻ¨ā§āĻ¤ā§ āĻ‡āĻ¨ā§āĻ¸āĻŸāĻ˛ āĻ•āĻ°ā§‡ āĻ†āĻŽāĻŋ āĻ°ā§€āĻ¤āĻŋāĻŽāĻ¤ āĻŽā§āĻ—ā§āĻ§āĨ¤āĻĻāĻžāĻ°ā§āĻ¨ āĻ‡āĻ‰āĻœāĻžāĻ° āĻĢā§āĻ°ā§‡āĻ¨ā§āĻĄāĻ˛āĻŋ āĻ‡āĻ¨ā§āĻŸāĻžāĻ°āĻĢā§‡āĻ¸, āĻĄā§‡āĻŦāĻŋā§ŸāĻžāĻ¨ā§‡āĻ° āĻļāĻ•ā§āĻ¤āĻŋāĻļāĻžāĻ˛ā§€ āĻĒā§āĻ¯āĻžāĻ•ā§‡āĻœ āĻŽā§āĻ¯āĻžāĻ¨ā§‡āĻœāĻžāĻ° āĻāĻŦāĻ‚ āĻĻāĻžāĻ°ā§āĻ¨ āĻ¸āĻŦ āĻ“āĻĒā§‡āĻ¨ āĻ¸ā§‹āĻ°ā§āĻ¸ (āĻāĻŦāĻ‚ āĻ•ā§āĻ˛ā§‹āĻœ āĻ¸ā§‹āĻ°ā§āĻ¸āĻĄ) āĻĒā§āĻ¯āĻžāĻ•ā§‡āĻœā§‡āĻ° āĻŦāĻĻā§ŒāĻ˛āĻ¤ā§‡ āĻāĻ•āĻŦāĻžāĻ°ā§‡āĻ° āĻœāĻ¨ā§āĻ¯āĻ“ āĻŽāĻ¨ā§‡āĻ‡ ‌āĻšā§ŸāĻ¨āĻŋ āĻ¯ā§‡ āĻ‰āĻ‡āĻ¨ā§āĻĄā§‹āĻœā§‡ āĻ†āĻ° āĻĢā§‡āĻ°āĻžāĻ° āĻĻāĻ°āĻ•āĻžāĻ° āĻ†āĻ›ā§‡āĨ¤ āĻāĻ›āĻžā§œāĻž āĻ‰āĻ‡āĻ¨ā§āĻĄā§‹āĻœā§‡ āĻ†āĻŽāĻžāĻ° āĻ–ā§āĻŦāĻ‡ āĻĢā§‡āĻ­āĻžāĻ°āĻŋāĻŸ āĻ•ā§Ÿā§‡āĻ•āĻŸāĻŋ āĻ¸āĻĢāĻŸāĻ“ā§Ÿā§āĻ¯āĻžāĻ° āĻ›āĻŋāĻ˛ (āĻ¸ā§‡āĻ—ā§āĻ˛ā§‹āĻ“ āĻĢā§āĻ°āĻŋ) āĻ¯ā§‡āĻ—ā§āĻ˛ā§‹āĻ° āĻ˛āĻŋāĻ¨āĻžāĻ•ā§āĻ¸ āĻĒā§‹āĻ°ā§āĻŸ āĻ†āĻŽāĻŋ āĻĒāĻžāĻ‡āĻ¨āĻŋ – āĻ¤āĻžāĻ‡ āĻ“ā§ŸāĻžāĻ‡āĻ¨ āĻ‡āĻ¨ā§āĻ¸āĻŸāĻ˛ āĻ•āĻ°ā§‡ āĻ¨āĻŋā§Ÿā§‡āĻ›āĻŋ āĻ¸ā§‡āĻ—ā§āĻ˛ā§‹ āĻšāĻžāĻ˛āĻžāĻ¨ā§‹āĻ° āĻœāĻ¨ā§āĻ¯āĨ¤ āĻ¨āĻŋāĻšā§‡ āĻ†āĻŽāĻžāĻ° āĻĢā§‡āĻ­āĻžāĻ°āĻŋāĻŸ āĻĒā§āĻ¯āĻžāĻ•ā§‡āĻœ āĻ—ā§āĻ˛ā§‹āĻ° āĻāĻ•āĻŸāĻž āĻ˛āĻŋāĻ¸ā§āĻŸ āĻ•āĻ°āĻ˛āĻžāĻŽ – āĻ•āĻžāĻ°ā§‹ āĻ•āĻžāĻœā§‡ āĻ˛āĻžāĻ—āĻ¤ā§‡āĻ“ āĻĒāĻžāĻ°ā§‡āĨ¤

āĻĢāĻŸā§‹āĻļāĻĒā§‡āĻ° āĻŦāĻŋāĻ•āĻ˛ā§āĻĒ ‌āĻšāĻŋāĻ¸ā§‡āĻŦā§‡ āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻ•āĻ°āĻ›āĻŋ āĻœāĻŋāĻŽā§āĻĒāĻļāĻĒ
āĻ‡āĻ˛āĻžāĻ¸ā§āĻŸā§āĻ°ā§‡āĻŸāĻ°ā§‡āĻ° āĻŦāĻŋāĻ•āĻ˛ā§āĻĒ āĻ‡āĻ‚āĻ•āĻ¸ā§āĻ•ā§‡āĻĒ
āĻ¸āĻŋāĻĄāĻŋ/āĻĄāĻŋāĻ­āĻŋāĻĄāĻŋ āĻ°āĻžāĻ‡āĻŸ āĻ•āĻ°āĻžāĻ° āĻœāĻ¨ā§āĻ¯ āĻ•ā§‡āĻĨā§āĻ°āĻŋāĻŦāĻŋ (k3b)
āĻ“āĻĒā§‡āĻ¨ āĻ…āĻĢāĻŋāĻ¸ – āĻ†āĻŽāĻžāĻ° āĻ“ā§ŸāĻžāĻ°ā§āĻĄ āĻĒā§āĻ°āĻ¸ā§‡āĻ¸āĻŋāĻ‚, āĻ¸ā§āĻĒā§āĻ°ā§‡āĻĄāĻļāĻŋāĻŸ āĻāĻŦāĻ‚ āĻĒā§āĻ°ā§‡āĻœā§‡āĻ¨ā§āĻŸā§‡āĻļāĻ¨ āĻ¤ā§ˆāĻ°ā§€āĻ° āĻ•āĻžāĻœā§‡
āĻĢāĻžāĻ‡āĻ˛āĻœāĻŋāĻ˛āĻž āĻ†āĻŽāĻžāĻ° āĻ­āĻžāĻ˛ āĻ˛āĻžāĻ—ā§‡ āĻ¨āĻž – āĻ¤āĻžāĻ‡ āĻāĻ¸āĻāĻĢāĻŸāĻŋāĻĒāĻŋāĻ° āĻœāĻ¨ā§āĻ¯ āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻ•āĻ°āĻŋ āĻ‰āĻ‡āĻ¨āĻāĻ¸āĻ¸āĻŋāĻĒāĻŋ (WinSCP) āĻāĻŦāĻ‚ āĻ¸āĻžāĻ§āĻžāĻ°āĻ¨ āĻāĻĢāĻŸāĻŋāĻĒāĻŋāĻ° āĻœāĻ¨ā§āĻ¯ āĻŸā§‹āĻŸāĻžāĻ˛ āĻ•āĻŽāĻžāĻ¨ā§āĻĄāĻžāĻ°
āĻ­āĻŋāĻĄāĻŋāĻ“ āĻĻā§‡āĻ–āĻžāĻ° āĻ•āĻžāĻœā§‡ āĻ­āĻŋāĻāĻ˛āĻ¸āĻŋ āĻĒā§āĻ˛ā§‡ā§ŸāĻžāĻ°
āĻ—āĻžāĻ¨ āĻļā§‹āĻ¨āĻžāĻ° āĻœāĻ¨ā§āĻ¯ āĻ°āĻŋāĻĻāĻŽāĻŦāĻ•ā§āĻ¸
āĻšā§āĻ¯āĻžāĻŸ āĻ•āĻ°āĻžāĻ° āĻœāĻ¨ā§āĻ¯ āĻĒāĻŋāĻœāĻŋāĻ¨
āĻŦā§āĻ°āĻžāĻ‰āĻœāĻžāĻ° ‌āĻšāĻŋāĻ¸ā§‡āĻŦā§‡ āĻ•āĻŋ āĻ‡āĻ‰āĻœ āĻ•āĻ°āĻŋ āĻ¤āĻž āĻ•āĻŋ āĻ†āĻŦāĻžāĻ° āĻŦāĻ˛āĻž āĻ˛āĻžāĻ—āĻŦā§‡? āĻ…āĻŦāĻļā§āĻ¯āĻ‡ āĻĢāĻžā§ŸāĻžāĻ°āĻĢāĻ•ā§āĻ¸ āĻāĻŦāĻ‚ āĻ…āĻĒā§‡āĻ°āĻž
āĻĄāĻžāĻ‰āĻ¨āĻ˛ā§‹āĻĄ āĻ…ā§āĻ¯āĻžāĻ•āĻ¸ā§‡āĻ˛āĻžāĻ°ā§‡āĻŸāĻ° ‌āĻšāĻŋāĻ¸ā§‡āĻŦā§‡ āĻŽāĻžāĻ˛ā§āĻŸāĻŋāĻ—ā§‡āĻŸ (Multiget)
āĻ•ā§‹āĻĄāĻ˛ā§‡āĻ–āĻžāĻ° āĻœāĻ¨ā§āĻ¯ āĻœāĻŋāĻ¨āĻŋ (Geany), āĻœā§‡āĻ¨ā§āĻĄ āĻ¸ā§āĻŸā§āĻĄāĻŋāĻ“, āĻ¨ā§‡āĻŸāĻŦāĻŋāĻ¨āĻ¸ āĻāĻŦāĻ‚ āĻāĻ¸āĻĒāĻŋāĻ•ā§‡āĻŸ āĻ†āĻ‡āĻĄāĻŋāĻ‡ (SPket IDE)
āĻ‡āĻ‚āĻ˛āĻŋāĻļ āĻŸā§ āĻ‡āĻ‚āĻ˛āĻŋāĻļ āĻĄāĻŋāĻ•āĻļāĻ¨āĻžāĻ°ā§€āĻ° āĻœāĻ¨ā§āĻ¯ āĻ‡āĻ‰āĻœ āĻ•āĻ°āĻŋ āĻœāĻžāĻ˛āĻŋāĻ‚āĻ—ā§‹ (Jalingo)
āĻĒā§‡āĻœāĻŽā§‡āĻ•āĻžāĻ° ‌āĻšāĻŋāĻ¸ā§‡āĻŦā§‡ āĻ¸ā§āĻ•ā§āĻ°āĻžāĻ‡āĻŦāĻžāĻ¸
āĻ¸āĻŋāĻāĻ‡â€ŒāĻšāĻāĻŽ (CHM) āĻĢāĻžāĻ‡āĻ˛ āĻĒā§œāĻžāĻ° āĻ•āĻžāĻœā§‡ āĻāĻ•ā§āĻ¸āĻ¸āĻŋāĻāĻ‡āĻšāĻāĻŽ (xCHM)
āĻĒāĻŋāĻĄāĻŋāĻāĻĢ āĻĢāĻžāĻ‡āĻ˛ āĻĒā§œāĻžāĻ° āĻœāĻ¨ā§āĻ¯ āĻāĻ­āĻŋāĻ¨ā§āĻ¸ (Evince)
āĻŽāĻžāĻ‡āĻāĻ¸āĻ•āĻŋāĻ‰āĻāĻ˛ āĻœāĻŋāĻ‡āĻ‰āĻ†āĻ‡ āĻĢā§āĻ°āĻ¨ā§āĻŸāĻāĻ¨ā§āĻĄ ‌āĻšāĻŋāĻ¸ā§‡āĻŦā§‡ āĻāĻ¸āĻ•āĻŋāĻ‰āĻāĻ˛ āĻ‡ā§Ÿā§‹āĻ— (SQLYog)

āĻ†āĻ° āĻ•āĻ–āĻ¨ā§‹āĻ‡ āĻ‰āĻ‡āĻ¨ā§āĻĄā§‹āĻœā§‡ āĻĢā§‡āĻ°āĻž āĻšāĻŦā§‡ āĻ¨āĻž āĻ†āĻŽāĻžāĻ° 😀 – āĻ†āĻĢāĻŋāĻĢ (āĻ†āĻŽāĻžāĻ° āĻ›ā§‡āĻ˛ā§‡) āĻ“ āĻ›ā§‹āĻŸāĻŦā§‡āĻ˛āĻž āĻĨā§‡āĻ•ā§‡āĻ‡ āĻ˛āĻŋāĻ¨āĻžāĻ•ā§āĻ¸ā§‡āĻ‡ āĻ•āĻžāĻœ āĻ•āĻ°āĻŦā§‡ āĻ‡āĻ¨āĻļāĻžāĻ˛ā§āĻ˛āĻžāĻšāĨ¤

Hacking SlideShare.net using PHP

Duh! you really believed that tricky title? come on!

But hey, wait. Here’s something I’ve found for you!

I am a big fan of slideshare becoz of their fantastic presentation sharing service and also the display. but it also hurts me when I can’t download some of these awesome slides available there for my offline reading. So I just spent some time today analyzing the HTTP requests made by the player available in slideshare using LiveHTTPHeader extension and found a way to download any presentation you want! There are many slides available in slideshare where you see that “Download not available” – But as long you have some knowledge on web-scrapping, that doesn’t matter at all.

Look at the following PHP code which gives you a list of URLs of the slides from any slideshow in slideshare.net – whether the presentation is available to download or not! for example the presentation on “Ajax and PHP” by John Coggeshall is not available to download. The url is of that presentation is http://www.slideshare.net/coogle/ajax-and-php


<?php
$slideshowUrl="http://www.slideshare.net/coogle/ajax-and-php";
$slideshowPageContent = file_get_contents($slideshowUrl);
$pattern = "~doc=([\w-]+)~";
preg_match($pattern,$slideshowPageContent,$matches);
$xmlurl = "http://s3.amazonaws.com/slideshare/{$matches[1]}.xml";


$sxml = simplexml_load_file($xmlurl);

foreach ($sxml->Slide as $slide)
echo $slide['Src']."<br />";
?>

The output will be something like this

https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-1.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-2.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-3.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-4.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-5.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-6.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-7.swf
..........
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-40.swf

I am sure you are going to love me! 😀

Installing Imagick extension for PHP in Ubuntu 7.10

I already have ImageMagick installed in my machine and I tried to install the Imagick extension for PHP but I was stuck with strange errors. I have spent couple of hours today to figure out what I did wrong and Why I cant build that extension. Finally I’ve figured out that I must install ImageMagick from source first to build that extension. Heres how to

1. You have to install ImageMagick from source and Its a Must. Otherwise the extension for PHP wont compile. It will show you a strange error like magic_wand.h not found.

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar zxf ImageMagick.tar.gz
cd ImageMagick-6.3.8
./configure
sudo make
sudo make install

2. Now download the Imagick extension source from pecl.php.net – I tried imagick-2.1.0RC3

wget http://pecl.php.net/get/imagick-2.1.0RC3.tgz
tar zxf imagick-2.1.0RC3.tgz
cd imagick-2.1.0RC3
phpize && ./configure
sudo make
sudo make install

This will make compile imagick source and build imagick.so – In my machine, I found imagick.so in the following directory

/usr/lib/php5/20060613+lfs

3. Now add “extension=imagick.so” in your php.ini (You may need to write the full path of imagick.so based on your configuration)

4. Restart your web server and thats it

Look at the php ini – you will see something like below (Click to enlarge)

Imagick