Cleanup: Difference between revisions

From Cheatsheet
Jump to navigation Jump to search
Line 46: Line 46:
  ln -s /usr/local/lib/libMagickWand-Q16.so /usr/local/lib/libMagickWand.so
  ln -s /usr/local/lib/libMagickWand-Q16.so /usr/local/lib/libMagickWand.so
  ln -s /usr/local/lib/libMagickCore-Q16.so /usr/local/lib/libMagickCore.so
  ln -s /usr/local/lib/libMagickCore-Q16.so /usr/local/lib/libMagickCore.so
phpize
  export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && ./configure --without-x --with-perl-options=LIBS='-L../magick/.libs -lMagickCore -L../wand/.libs -lMagickWand -lm'
  export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && ./configure --without-x --with-perl-options=LIBS='-L../magick/.libs -lMagickCore -L../wand/.libs -lMagickWand -lm'
  make && make install
  make && make install

Revision as of 21:30, 10 February 2013

ImageMagick

First we need to remove any ImageMagick RPMs

rpm -qa ImageMagick | xargs rpm -e

Customers may want Ghostscript fonts installed, so install those:

yum install ghostscript-fonts

Next we need to get the source and compile it

cd /usr/local/src
wget http://layer3.liquidweb.com/scripts/plBake/packages/ImageMagick-6.8.2-2.tar.gz
tar zxvf ImageMagick-6.8.2-2.tar.gz
cd ImageMagick-6.*
./configure --without-x --with-perl-options=LIBS='-L../magick/.libs -lMagickCore -L../wand/.libs -lMagickWand -lm'
make && make install
/etc/init.d/httpd restart

Now test with the following.

php -i | grep -i imagemagick

IMagick

cd /usr/local/src
wget http://layer3.liquidweb.com/scripts/plBake/packages/imagick-3.1.0RC2.tgz
tar -zxvf imagick-3.1.0RC2.tgz
cd imagick-3.1.0RC2
phpize
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure --without-x --with-perl-options=LIBS='-L../magick/.libs -lMagickCore -L../wand/.libs -lMagickWand -lm'
make && make install
echo "extension=imagick.so" >> /usr/local/lib/php.ini
/etc/init.d/httpd restart

Now test with the following.

php -i | grep -i imagick

Magickwand

cd /usr/local/src
wget http://layer3.liquidweb.com/scripts/plBake/packages/MagickWandForPHP-1.0.9.tar.gz
tar -zxvf MagickWandForPHP-1.0.9.tar.gz
cd MagickWandForPHP-1.0.9
ln -s /usr/local/lib/libMagickWand-Q16.so /usr/local/lib/libMagickWand.so
ln -s /usr/local/lib/libMagickCore-Q16.so /usr/local/lib/libMagickCore.so
phpize
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && ./configure --without-x --with-perl-options=LIBS='-L../magick/.libs -lMagickCore -L../wand/.libs -lMagickWand -lm'
make && make install
echo "extension=magickwand.so" >> /usr/local/lib/php.ini
/etc/init.d/httpd restart

Now test with the following.

php -i | grep -i magickwand

PerlMagick

cd /usr/local/src/ImageMagick-6.8.2-2/PerlMagick
perl Makefile.PL
make && make install
/etc/init.d/httpd restart

Now test with the following.

 perl -MImage::Magick -e "print \"Module installed.\\n\";"





Next we need to install the Perl module

perl -MCPAN -e 'install Image::Magick'

I have ran into it a couple time now where the make test will fail on this, but it will install without an issue with the following:

cpan
force install Image::Magick

If the above perl command returns an error referring to install seems impossible try the following:

cd PerlMagick/
perl Makefile.PL
make && make install

You can check to see if the module is installed by running:

instmodsh
At the cmd? prompt, press l.
The module should be listed as Image::Magick

Install IMagick for PHP 5.4

cd /usr/local/src
wget http://www.imagemagick.org/download/ImageMagick-6.8.2-1.tar.gz
tar -zxvf ImageMagick-6.8.2-1.tar.gz
cd ImageMagick-6.8.2-1
 ./configure --without-x --with-perl-options=LIBS='-L../magick/.libs -lMagickCore -L../wand/.libs -lMagickWand -lm'
make && make install

Next Perl Magick

perl -MCPAN -e 'install Image::Magick'

or the following if you have problems:

cpan
force install Image::Magick

Next install Release candidate for imagick that has bug fix for php 5.4

cd /usr/local/src
wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar -zxvf imagick-3.1.0RC2.tgz
cd imagick-3.1.0RC2
phpize
./configure
make && make install
echo "extension=imagick.so" >> /usr/local/lib/php.ini
/etc/init.d/httpd restart

Next install updated magickwand

cd /usr/local/src
wget http://www.magickwand.org/download/php/MagickWandForPHP-1.0.9-1.tar.gz
tar -zxvf MagickWandForPHP-1.0.9-1
cd MagickWandForPHP-1.0.9
phpize
./configure
make && make install
echo "extension=magickwand.so" >> /usr/local/lib/php.ini
/etc/init.d/httpd restart

Should be finished at this point for php 5.4 install of imagick. Be sure to run the tests to make sure that everything is working.

php -i | grep MagickWand
php -i | grep ImageMagick
php -i | grep imagick
convert -version

Install IMagick for PHP

Note: If ImageMagick updates their code you may need to get the newest version of IMagick from http://pecl.php.net/package/imagick

Requirements: ImageMagick version 6.2.4+ and PHP 5.1.3+.

wget http://pecl.php.net/get/imagick-3.0.1.tgz
tar vxzf imagick-3.0.1.tgz
cd imagick-3.0.1
phpize
./configure
make && make install
echo "extension=imagick.so" >> /usr/local/lib/php.ini
/etc/init.d/httpd restart

Test PHP to make sure that IMagick is installed

php -i | grep ImageMagick

This should return a line similar to:

ImageMagick version => ImageMagick 6.5.0-7 2009-03-25 Q16 http://www.imagemagick.org

Install MagickWand for PHP

Note: If the download link is broke. Grab the latest source from http://www.magickwand.org/download/php/

wget http://www.magickwand.org/download/php/MagickWandForPHP-1.0.9.tar.gz
tar vzxf MagickWandForPHP-1.0.9.tar.gz
cd MagickWandForPHP-1.0.9
phpize
./configure
make && make install
echo "extension=magickwand.so" >> /usr/local/lib/php.ini
/etc/init.d/httpd restart

Check that MagickWand installed properly

php -i | grep MagickWand

You should see a line similar to

MagickWand Backend Library => ImageMagick
MagickWand Extension Version => 1.0.9

64bit Tested with ImageMagick 6.4.0-2

deleted old. 32bit instructions should work fine for 64bit as well. Use lwbake unless you know what you're doing.

Install IMagick for PHP

Note: If ImageMagick updates their code you may need to get the newest version of IMagick from http://pecl.php.net/package/imagick

Requirements: ImageMagick version 6.2.4+ and PHP 5.1.3+.

wget http://pecl.php.net/get/imagick-2.3.0.tgz
tar vxzf imagick-2.3.0.tgz
cd imagick-2.3.0
phpize
./configure
make && make install
echo "extension=imagick.so" >> /usr/local/lib/php.ini
/etc/init.d/httpd restart

Test PHP to make sure that IMagick is installed

php -i | grep ImageMagick

This should return a line similar to:

ImageMagick version => ImageMagick 6.4.0 03/29/08 Q16 http://www.imagemagick.org


Install MagickWand for PHP

Note: If the download link is broke. Grab the latest source from http://www.magickwand.org/download/php/

MW="MagickWandForPHP-1.0.9-1"
wget http://www.magickwand.org/download/php/${MW}.tar.gz
tar vxzf ${MW}.tar.gz
cd MagickWandForPHP*
phpize
./configure
make && make install
echo "extension=magickwand.so" >> /usr/local/lib/php.ini
/etc/init.d/httpd restart

Check that MagickWand installed properly

php -i | grep MagickWand

You should see a line similar to

MagickWand Backend Library => ImageMagick
MagickWand Extension Version => 1.0.9


--OLD--

ImageMagick can now be installed by using a cPanel script:

/scripts/installimagemagick

You may also want to install NetPBM as some scripts use that instead of Imagemagick.

yum install netpbm-progs


There is an ImageMagick package in the CentOS yum repository, but installing via this method has shown to be either problematic or disastrous, particularly on servers hosting Movable Type sites. Further, the ImageMagick-perl package in the repo will not work with recent Cpanel servers, as it installs to a particular version of Perl. Please refrain from installing ImageMagick via yum.


Imagick

Imagick is a php extension that adds imagemagick functions to php. As of right now, the only version that actually compiles successfully for php5 is 0.9.13

You can install it with:

cd /tmp/pear/cache/
pecl download imagick-0.9.13
tar zxvf imagick-0.9.13.tgz
cd imagick-0.9.13/
phpize
./configure
make && make install

Then add extension=imagick.so to the php.ini


Troubleshooting

libMagickCore.so.1: cannot open shared object file

If, after installing ImageMagick, you receive the following error"

convert: error while loading shared libraries: libMagickCore.so.1: cannot open shared object file: No such file or directory

You need to reinstall with the following method:

./configure LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib"
make && make install

PHP Upgraded?

Most everything will need to be recompiled to work with the new php version.

cd /usr/local/src/lwbake

Go into each folder in turn and run through the phpize and compile scripts. then run a "make clean" and "make && make install" as usual.


Cant install the perl module

It occurs sometimes that you are unable to install the Image::Magick perl module. Determine the version the Image::Magick that the perl installer is trying to add in relation to your convert --version output. The ImageMagick version must be higher than the perl Image::Magick version. For example, if you have ImageMagick 6.7.0 installed, but you are trying to install Image::Magick 6.77, it will fail. You will need ImageMagick 6.7.7 or higher.

In this case, get the source files from imagemagick.org and upgrade manually above the attempted install version.