Today I want to show the steps needed to install the Imagick extension for PHP on Linux CentOS.
First of all access to your Linux shell (in my case, since it is a remote server, I use SSH).
Take root privileges typing the command su and then insert the password requested by the system:
[adminxxx@yourserver / ]$ su Password: <type your password, but it will not be visible...>
Now type the following commands:
yum install ImageMagick ImageMagick-devel yum install gcc make automake php-pear php-devel pecl install imagick
Each one of the previous command will give you a verbose output of the status of the installation.
After the installation I noticed that the file “imagick.so” didn’t have the execution attribute that instead had other extension contained in the folder “/usr/lib64/php/modules”.
So you have to set it manually:
cd /usr/lib64/php/modules/ chmod 755 imagick.so
Now you have to update your php.ini file adding the following line:
extension=imagick.so
If your server uses Plesk (in my case Plesk version is Onyx 17.0.17), you can add the directive in your web site configuration, clicking on “PHP Settings” and adding it in the field named “Additional directives”.
Now let’s restart Apache…
apachectl restart
On my server I initially found some strange beahviors: without an explanation I sometimes get the “Class Imagick not found” exception, that I solved restarting the whole server.
The job is done!