1

I just set up my production server on Ubuntu 16 and PHP7/Apache. I have installed the Graphics Magick package locally using

brew install php56-gmagick

Doing that installs graphics magick as well as the php module so it is accessible using the GMagick php class.

On the server I can install graphics magick using

sudo apt-get install graphicsmagick

The package was installed successfully but does not include a PHP helper class.

Does anyone out there know if there is a package to take care of installing that?

Also, I was able to get Imagick installed and working with php using the command:

sudo apt-get install php-imagick

I am interested in comparing the performance of the two to see which is lighter on the server.

I am looking here:

http://packages.ubuntu.com/xenial/php/
http://packages.ubuntu.com/xenial/graphics/

2 Answers 2

3

Install Pear so you can use pecl

sudo apt install php-pear

Install phpize which is require by gmagick

sudo apt install php7.0-dev graphicsmagick libgraphicsmagick1-dev

This installs the PHP extension:

sudo pecl install gmagick-2.0.4RC1

This loads the extension in the php.ini

sudo sh -c 'echo "extension=gmagick.so" >>  /etc/php/7.0/apache2/php.ini'

Restart Apache

sudo service apache2 restart
13
  • Thanks Matt, I guess all I would need to do is change to ``` /etc/php/7.0/apache2/php.ini ``` also how to install pecl? Oct 14, 2016 at 19:21
  • Fixed! PECL is part of php-pear.
    – Matt O.
    Oct 14, 2016 at 19:22
  • Almost there, thank you for making that update and explaing PECL PEAR relationship. running: phpize sh: 1: phpize: not found ERROR: `phpize' failed Oct 14, 2016 at 19:29
  • sudo apt-get install php7.0-dev
    – Matt O.
    Oct 14, 2016 at 19:30
  • Just as a note, I noticed with Brew you installed PHP 5.6's gmagick. I would warn against using brew at all on Ubuntu systems. It's wayyy easier to use Launchpad and Apt imho.
    – Matt O.
    Oct 14, 2016 at 19:33
2

Since there's now an Imagick package for PHP 7.0, you can do the following:

sudo apt-get update
sudo apt-get install php-imagick graphicsmagick
sudo service apache2 reload

To test, run:

$ php -i |grep imagick
/etc/php/7.0/cli/conf.d/20-imagick.ini,
imagick
imagick module => enabled
imagick module version => 3.4.0RC6
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.skip_version_check => 0 => 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.