ImageMagick是一个免费的创建、编辑、合成图片的软件。它可以读取、转换、写入多种格式的图片。图片切割、颜色替换、各种效果的应用,图片的旋转、组合,文本,直线,多边形,椭圆,曲线,附加到图片伸展旋转。ImageMagick是免费软件:全部源码开放,可以自由使用,复制,修改,发布,它遵守GPL许可协议,可以运行于大多数的操作系统,ImageMagick的大多数功能的使用都来源于命令行工具。
【获取链接】
在pecl上查看需要安装的扩展链接
1)下载
wget https://pecl.php.net/get/imagick-3.7.0.tgz
2)解压缩
tar -zxvf imagick-3.7.0.tgz
3)进入目录
cd imagick-3.7.0/
4)建立php的外挂模块
/usr/local/php/bin/phpize
5)生成Makefile
./configure --with-php-config=/usr/local/php/bin/php-config
6)编译安装
make && make install
【可能出现的错误】
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
解决方案
yum install MagickWand-config
1)可能出现的错误
Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package MagickWand-config
2)解决方案
yum install libmagickcore-dev libmagickwand-dev
【再次生成Makefile】
./configure --with-php-config=/usr/local/php/bin/php-config
1)编译安装
make && make install
2)编译成功
.... PATH="$PATH:/sbin" ldconfig -n /root/imagick-3.7.0/modules ---------------------------------------------------------------------- Libraries have been installed in: /root/imagick-3.7.0/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- Build complete. Don't forget to run 'make test'. Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20200930/ Installing header files: /usr/local/php/include/php/
此时在/usr/local/php/lib/php/extensions/no-debug-non-zts-20200930/目录下就生成了编译的文件目录进入目录就会看到imagick.so文件了
【添加扩展】
vim /usr/local/php/etc/php.ini
在文件中加入一行
extension=imagick.so
重启PHP服务后就完了添加。
登录后可发表评论
11月15日 16:58