Let's install GraphicsMagick!
cd /usr/local/src wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/GraphicsMagick-LATEST.tar.gz tar xvfz GraphicsMagick-LATEST cd GraphicsMagick-* ./configure --enable-shared make make install
Let's test it.
gm version
If you get this error:
gm: error while loading shared libraries: libGraphicsMagick.so.3: cannot open shared object file: No such file or directory
Do this to fix:
echo "/usr/local/lib" >> /etc/ld.so.conf ldconfig
Ok... Let's install GMagick PHP extension
pecl/gmagick for PHP 5.6
cd /usr/local/src wget https://pecl.php.net/get/gmagick-1.1.7RC3.tgz #this is the last PHP 5.6 version supported tar xfvz gmagick cd gmagick-* /usr/local/php56/bin/phpize56 ./configure --with-php-config=/usr/local/php56/bin/php-config ### PHP 5.6 make make install
Add the extension to your php.ini
/usr/local/bin/php --ini | grep 'Loaded Configuration File' ### Find the location of your main php.ini vi /usr/local/php56/lib/php.ini ### PHP5.6 ### Add the following extension=gmagick.so ### Restart apache/php-fpm systemctl restart php-fpm56 ### PHP5.6 php-fpm systemctl restart httpd ### Or service php-fpm56 restart service httpd restart
pecl/gmagick for PHP 7
cd /usr/local/src wget https://pecl.php.net/get/gmagick tar xfvz gmagick cd gmagick-* /usr/local/php70/bin/phpize70 /usr/local/php71/bin/phpize71 ./configure --with-php-config=/usr/local/php70/bin/php-config ### PHP7.0 ./configure --with-php-config=/usr/local/php71/bin/php-config ### PHP7.1 make make install
Add the extension to your php.ini
/usr/local/bin/php --ini | grep 'Loaded Configuration File' ### Find the location of your main php.ini vi /usr/local/php70/lib/php.ini ### PHP7.0 vi /usr/local/php71/lib/php.ini ### PHP7.1 ### Add the following extension=gmagick.so ### Restart apache/php-fpm systemctl restart php-fpm71; systemctl restart php-fpm70 systemctl restart httpd ### Or service php-fpm71 restart; service php-fpm70 restart service httpd restart
Install GhostScript (for PDF conversion)
cd /usr/local/src # this is the latest free version wget http://downloads.ghostscript.com/public/old-gs-releases/ghostscript-9.18.tar.gz tar xvfz ghostscript-9.18.tar.gz cd ghostscript-9.18 ./configure make make install rm -rf /usr/bin/ghostscript; ln -s /usr/local/bin/gs /usr/bin/ghostscript <./pre>DEPRECATED
pecl -d preferred_state=beta install gmagickLet's add this to our php.ini under our other PHP extensions.
extension=gmagick.soRestart apache and we're done.
service httpd restart