Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imagemagick install problems in centos

i'm trying to install imagemagick on my server (centos 7.1 minimal) by this url: imagemagick installation steps

get this error in step 1:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.de.leaseweb.net
 * epel: mirrors.n-ix.net
 * extras: mirror.de.leaseweb.net
 * remi: remi.schlundtech.de
 * remi-php55: remi.schlundtech.de
 * remi-php56: remi.schlundtech.de
 * remi-safe: remi.schlundtech.de
 * remi-test: remi.schlundtech.de
 * updates: mirror.de.leaseweb.net
Package gcc-4.8.3-9.el7.x86_64 already installed and latest version
No package php-devel available.
No package php-pear available.
Nothing to do
like image 841
ali moradi Avatar asked Mar 15 '23 03:03

ali moradi


2 Answers

Because this item has been questioned on many sites, I fully explain the installation process... this proccess tested on centos 6.5 and php56 and imagick-3.4.3(ImageMagick-7)
Change the installation process for any part that needs to be changed like as your php version or folder.

you can find lasted version of "ImageMagick" in ImageMagick versions ; use lasted stable version.

If you have already installed "ImageMagick" several times, first remove all of them and find "ImageMagick" & "imagick" folders & files and clean all of them and continue the installation process with this process.

# yum remove ImageMagick ImageMagick-devel

Use the following command to find a file or folder:

# find / -name 'ImageMagick*'
# find / -name 'imagick*

Find and delete all the files and folders that are displayed

Start Installation php-pear:
Ensure you have php-pear installed, which will be used later to install Imagick PHP module. If you don’t have pear, you can install using Yum:

# yum install php-pear

If you see the following error:
No package php—pear available.
Error: Nothing to do
solation:

# cd /etc/

and open yum.conf

OR

# nano /etc/yum.conf

And then find and remove php* and save file

then type:

# yum install --enablerepo remi php-pear php-devel

for test success Installation: type:

# yum info php-pear

result is something like this :

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * epel: yum.ds.stackexchange.com
stack-local-prod                                                                                                                                                                                                   | 2.9 kB     00:00
Available Packages
Name        : php-pear
Arch        : noarch
Epoch       : 1
Version     : 1.9.4
Release     : 4.el6
Size        : 393 k
Repo        : base
Summary     : PHP Extension and Application Repository framework
URL         : http://pear.php.net/package/PEAR
License     : BSD and PHP and LGPLv2+
Description : PEAR is a framework and distribution system for reusable PHP
            : components.  This package contains the basic PEAR components.

Start Installation ImageMagick:

# yum install ImageMagick
# yum install ImageMagick-devel
# pecl install Imagick

Important: copy "ImageMagick" folder from "/usr/include" to "/usr/local/include" for ImageMagick find "MagickWand.h"

# cd /usr/include
# cp ImageMagick /usr/local/include

before below lines don't forget: go to "php.ini" find "disable_functions" and clean "proc_open,popen,proc_close" becuase make imagick needs these functions, after complete installation you can add this functions to your "disable_functions" on "php.ini" file.

continue:

# cd /usr/local/src 
# wget http://pecl.php.net/get/imagick-3.4.3.tgz
# tar xzfv imagick-3.4.3.tgz
# cd imagick-3.4.3
# phpize
# ./configure --with-php-config=/usr/local/php56/bin/php-config
# make
# make install

copy Installing shared extensions: "/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/" this is extension dir
Copy "imagick.so" from "/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/" to "/usr/local/php56/lib/php/extensions/" extension directory.

# cd /usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/
# cp imagick.so /usr/local/php56/lib/php/extensions/

Then, edit "php.ini", find "Dynamic Extensions" add extension=imagick.so in a empty line, don't forget there are 2 or more "php.ini" on your server, you can find all of them:

# find / -name 'php.ini'

result may be like this

/etc/php.ini
/usr/local/php56/lib/php.ini

Use this file at all stages:

/usr/local/php56/lib/php.ini

for test success Installation:

# php -m | grep imagick

result should be: imagick

for find all php functions and extensions use :

# php -m

now you can find "imagick" at showed list
Don't forget: edit "php.ini", find "disable_functions" and add "proc_open,popen,proc_close" to disable_functions For server security!

now reboot your server

# reboot

for test imagick installation on php, use this code at php file:

if(extension_loaded('imagick')) {
  $imagick = new Imagick();
  print_r($imagick->queryFormats());
}
else {
  echo 'imagick is not available.';
}

OR use

echo phpinfo();
like image 158
Ferhad Konar Avatar answered Mar 17 '23 16:03

Ferhad Konar


According to the repository list in your paste, you are using "remi" repository for PHP. So, just

yum install php-pecl-imagick

No need to build from sources, when a RPM package exists.

But as yum doesn't even found php-devel, check yum configuration for "exclude" line, looks like a cpanel host which replace lot of base packages by their own.

like image 28
Remi Collet Avatar answered Mar 17 '23 15:03

Remi Collet