centos中的imagemagick安装问题 [英] imagemagick install problems in centos

查看:11
本文介绍了centos中的imagemagick安装问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过以下 url 在我的服务器(centos 7.1 最小)上安装 imagemagick:imagemagick 安装步骤

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

在步骤 1 中出现此错误:

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

推荐答案

因为这个项目在很多网站上都被质疑过,所以我把安装过程完整说明...这个过程在 centos 6.5 和 php56 和 imagick-3.4.3(ImageMagick-7) 上测试过
更改任何需要更改的部分的安装过程,例如您的 php 版本或文件夹.

您可以在 ImageMagick 版本 中找到ImageMagick"的最新版本;使用持续稳定的版本.

如果你已经安装了几次ImageMagick",首先将它们全部删除,然后找到ImageMagick"&imagick"文件夹和文件并清除所有文件,然后使用此过程继续安装过程.

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

开始安装php-pear:
确保您已安装 php-pear,稍后将使用它来安装 Imagick PHP 模块.如果没有 pear,可以使用 Yum 安装:

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

如果您看到以下错误:
没有包 php-pear 可用.
错误:无事可做
解决办法:

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

# cd /etc/

然后打开 yum.conf

and open yum.conf

# nano /etc/yum.conf

然后找到并删除php*并保存文件

And then find and remove php* and save file

然后输入:

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

测试成功安装:类型:

# yum info php-pear

结果是这样的:

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.

开始安装 ImageMagick:

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

重要提示:将ImageMagick"文件夹从/usr/include"复制到/usr/local/include",以便 ImageMagick 找到MagickWand.h"

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

在下面几行之前不要忘记:转到php.ini"找到disable_functions"并清理proc_open,popen,proc_close",因为make imagick需要这些功能,完成安装后您可以将此功能添加到您的disable_functions" 在 "php.ini" 文件上.

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.

继续:

# 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

复制安装共享扩展:/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/"这是扩展目录
将imagick.so"从/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/"复制到/usr/local/php56/lib/php/extensions/"扩展目录.

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/

然后,编辑php.ini",找到Dynamic Extensions"在一个空行中添加extension=imagick.so,别忘了你的服务器上有2个或多个php.ini",你可以找到所有其中:

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'

结果可能是这样的

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

在所有阶段都使用这个文件:

Use this file at all stages:

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

测试成功安装:

# php -m | grep imagick

结果应该是:imagick

查找所有 php 函数和扩展使用:

for find all php functions and extensions use :

# php -m

现在您可以在显示列表中找到imagick"
别忘了:编辑php.ini",找到disable_functions",将proc_open,popen,proc_close"添加到disable_functions,以保证服务器安全!

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!

现在重启你的服务器

# reboot

要在 php 上测试 imagick 安装,请在 php 文件中使用此代码:

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.';
}

或者使用

echo phpinfo();

这篇关于centos中的imagemagick安装问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆