PHP扩展ImageMagick安装

2022-11-11 11:16 By "Powerless" 2697 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
哈哈哈哈

View in WeChat

Others Discussion

  • MySQL中的行级锁,表级锁,页级锁
    Posted on 2018-08-25 11:00
  • MySQL分组
    Posted on 2019-11-18 14:00
  • PHP练习-爬楼梯问题
    Posted on 2020-08-14 23:56
  • PHP8.1 性能基准测试
    Posted on 2022-10-08 17:40
  • MySQL事务介绍
    Posted on 2019-06-05 18:14
  • 必学十大经典排序算法,看这篇就够了
    Posted on 2019-11-18 16:30
  • 巧用CAS解决数据一致性问题
    Posted on 2019-03-07 11:55
  • PHP练习-无重复字符的最长子串
    Posted on 2020-09-17 18:03