PHP扩展ImageMagick安装

2022-11-11 11:16 By "Powerless" 2628 1 0

【获取链接】

在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服务后就完了添加。

评 论

与众不同 0 2022-11-15 16:58
哈哈哈哈

Others Discussion

  • 分布式服务限流
    Posted on 2020-02-07 18:57
  • 有状态服务VS无状态服务
    Posted on 2020-02-07 18:18
  • 企业级PAAS云平台几个关键问题和挑战
    Posted on 2019-06-12 18:33
  • MySQL 单库后期分库策略
    Posted on 2019-08-19 14:31
  • Redis七大经典问题
    Posted on 2021-05-27 11:14
  • 关于HTTPS的五大误区
    Posted on 2020-02-02 01:10
  • PHP实现精确发布时间
    Posted on 2018-12-06 21:00
  • 为什么要测量尾部延迟
    Posted on 2020-09-18 10:34