LAMP: installing imagick on Ubuntu and CentOS + some thoughts

 

 

So I need to get Imagick php extension for an old web system i’ve got to work on these days. This is made so easy on Ubuntu:

root@webdev:~# apt-get install php5-imagic

Then just restart the web server:


root@webdev:~# /etc/init.d/apache2 restart

And that’s all! One line in ubuntu and we have that extension working. Life’s good!

Well it’s not, because we decided that Centos will be a better choice for a server operating system. The reason for that is because it is the free version of Redhat and it’s supposed to be “enterprise class”, so as you know in the IT industry, business class products are supposed to be better.

So I have to install imagick on a centos web server. Of course, the Ubuntu (Debian) packages do not work on Centos and there’s no apt-get (it uses yum instead which is not that sophisticated in my view).

So let’s see how we do it here. First of all, we need to get the main imagick package. That’s easy enough:

[root@webdev ~]# yum install ImageMagick.i386

And then the dev package:

[root@webdev ~]# yum install ImageMagick-devel.i386

Then I need to install the imagick php extension via pecl. This will require some compilation from sourse, so we need to ensure we have a compiler. So if you dont have gcc, you need to install it:

[root@webdev ~]# yum install gcc

Then we need to install via pecl:
[root@webdev ~]# pecl install imagick

Then we need to add “extension=imagick.so” to php’s configuration:

[root@webdev ~]# echo “extension=imagick.so” > /etc/php.d/imagick.ini

/etc/php.d is a directory which php scans on start up and loads every “.ini” file in there. What this exersize does is, it creates a new file called “imagick.ini” in that directory and puts “extension=imagick.so” as it’s content.

And then we need to restart the web server:

[root@webdev ~]# /etc/init.d/httpd restart

After that, we need to check the php extensions:
[root@webdev ~]# php-m

Notice it’s httpd (not apache2).

So why does it have to be different? Why does the name of the process daemon have to be apache2 in Debian and httpd in redhat? Can it not be httpd everywhere? Just the same as the way we have (sshd/mysqld/ircd/etc)? Why do I have to compile? It’s freaking 2011!

You see because of problems like that, we will have big players such as Microsoft. It’s just a lot of pointless hassle! Hassle for us, hassle for the developers who, instead of focusing on improving the product, they have to waste days packaging for different distributions.

And of course, now I will all get all those fans of different distros arguing how compiling is better and how we are lame because we prefer the ubuntu approach. But no matter what you say, you can not convince me that I am wrong and that compiling from source is better than apt-get.

I personally feel that centos so far has been nothing but hassle and I prefer ubuntu-server.