ali*_*adi 4 centos imagemagick
我正在尝试通过以下网址在我的服务器(最小 Centos 7.1)上安装 imagemagick: imagemagick 安装步骤
在步骤 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
Run Code Online (Sandbox Code Playgroud)
因为这个项目在很多网站上都被质疑过,所以我完整的解释了安装过程……这个过程在centos 6.5和php56上测试过,imagick-3.4.3(ImageMagick-7)
修改安装过程任何需要改动的部分就像您的 php 版本或文件夹一样。
您可以在ImageMagick 版本中找到“ImageMagick”的最新版本
;使用持久的稳定版本。
如果您已经多次安装“ImageMagick”,首先将它们全部删除并找到“ImageMagick”和“imagick”文件夹和文件并清理所有它们,然后继续安装过程。
# yum remove ImageMagick ImageMagick-devel
Run Code Online (Sandbox Code Playgroud)
使用以下命令查找文件或文件夹:
# find / -name 'ImageMagick*'
# find / -name 'imagick*
Run Code Online (Sandbox Code Playgroud)
查找并删除显示的所有文件和文件夹
开始安装 php-pear:
确保您已经安装了 php-pear,稍后将用于安装 Imagick PHP 模块。如果你没有梨,你可以使用 Yum 安装:
# yum install php-pear
Run Code Online (Sandbox Code Playgroud)
如果您看到以下错误:
No package php—pear available。
错误:无事可做
安慰:
# cd /etc/
Run Code Online (Sandbox Code Playgroud)
并打开 yum.conf
或者
# nano /etc/yum.conf
Run Code Online (Sandbox Code Playgroud)
然后找到并删除 php* 并保存文件
然后输入:
# yum install --enablerepo remi php-pear php-devel
Run Code Online (Sandbox Code Playgroud)
为测试成功安装:键入:
# yum info php-pear
Run Code Online (Sandbox Code Playgroud)
结果是这样的:
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.
Run Code Online (Sandbox Code Playgroud)
开始安装 ImageMagick:
# yum install ImageMagick
# yum install ImageMagick-devel
# pecl install Imagick
Run Code Online (Sandbox Code Playgroud)
# cd /usr/include
# cp ImageMagick /usr/local/include
Run Code Online (Sandbox Code Playgroud)
在下面几行之前不要忘记:去“php.ini”找到“disable_functions”并清理“proc_open,popen,proc_close”因为make imagick需要这些功能,完成安装后你可以将这些功能添加到“disable_functions”上php.ini”文件。
继续:
# 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
Run Code Online (Sandbox Code Playgroud)
复制安装共享扩展:“/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/”这是扩展目录
从“/usr/local/php56/lib”复制“imagick.so” /php/extensions/no-debug-non-zts-20131226/" 到 "/usr/local/php56/lib/php/extensions/" 扩展目录。
# cd /usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/
# cp imagick.so /usr/local/php56/lib/php/extensions/
Run Code Online (Sandbox Code Playgroud)
然后,编辑“php.ini”,找到“Dynamic Extensions”在空行中添加extension=imagick.so,不要忘记你的服务器上有2个或更多的“php.ini”,你可以找到它们:
# find / -name 'php.ini'
Run Code Online (Sandbox Code Playgroud)
结果可能是这样的
/etc/php.ini
/usr/local/php56/lib/php.ini
Run Code Online (Sandbox Code Playgroud)
在所有阶段使用此文件:
/usr/local/php56/lib/php.ini
Run Code Online (Sandbox Code Playgroud)
测试成功安装:
# php -m | grep imagick
Run Code Online (Sandbox Code Playgroud)
结果应该是: imagick
要查找所有 php 函数和扩展,请使用:
# php -m
Run Code Online (Sandbox Code Playgroud)
现在您可以在显示列表中找到“imagick”
不要忘记:
编辑“php.ini”,找到“disable_functions”并将“proc_open,popen,proc_close”添加到disable_functions 为了服务器安全!
现在重启你的服务器
# reboot
Run Code Online (Sandbox Code Playgroud)
要在 php 上测试 imagick 安装,请在 php 文件中使用此代码:
if(extension_loaded('imagick')) {
$imagick = new Imagick();
print_r($imagick->queryFormats());
}
else {
echo 'imagick is not available.';
}
Run Code Online (Sandbox Code Playgroud)
或使用
echo phpinfo();
Run Code Online (Sandbox Code Playgroud)