ubuntu 未在PHP中加载Imagick

6mw9ycah  于 2022-12-29  发布在  PHP
关注(0)|答案(3)|浏览(146)

我已经在Ubuntu 12. 04上安装了Imagick,但我仍然得到
未找到类“Ozar”
当我通过终端检查时
php -m语言
我得到

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
imagick
json
libxml
mbstring
mhash
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

但是当我通过PHP脚本检查加载的扩展时
获取加载的扩展()
我没有胡思乱想

Array
(
    [0] => Core
    [1] => date
    [2] => ereg
    [3] => libxml
    [4] => openssl
    [5] => pcre
    [6] => sqlite3
    [7] => zlib
    [8] => bcmath
    [9] => bz2
    [10] => calendar
    [11] => ctype
    [12] => curl
    [13] => dba
    [14] => dom
    [15] => hash
    [16] => fileinfo
    [17] => filter
    [18] => ftp
    [19] => gd
    [20] => gettext
    [21] => SPL
    [22] => iconv
    [23] => session
    [24] => intl
    [25] => json
    [26] => ldap
    [27] => mbstring
    [28] => mcrypt
    [29] => mssql
    [30] => standard
    [31] => mysqlnd
    [32] => mysqli
    [33] => mysql
    [34] => PDO
    [35] => pdo_mysql
    [36] => pdo_pgsql
    [37] => pdo_sqlite
    [38] => Phar
    [39] => posix
    [40] => Reflection
    [41] => imap
    [42] => shmop
    [43] => SimpleXML
    [44] => soap
    [45] => sockets
    [46] => exif
    [47] => sybase_ct
    [48] => sysvsem
    [49] => sysvshm
    [50] => tokenizer
    [51] => wddx
    [52] => xml
    [53] => xmlreader
    [54] => xmlwriter
    [55] => xsl
    [56] => zip
    [57] => apache2handler
    [58] => mhash
)

php -i显示

imagick 

module => enabled
imagick module version => 3.2.0RC1
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version => ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org
ImageMagick copyright => Copyright (C) 1999-2011 ImageMagick Studio LLC
ImageMagick release date => 2012-08-17
ImageMagick number of supported formats:  => 206
ImageMagick supported formats => 3FR, A, AAI, AI, ART, ARW, AVI, AVS, B, BGR, BGRA, BMP, BMP2, BMP3, BRF, C, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FITS, FRACTAL, FTS, G, G3, GIF, GIF87, GRADIENT, GRAY, GROUP4, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, J2C, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, M4V, MAC, MAP, MAT, MATTE, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YCbCr, YCbCrA, YUV

Directive => Local Value => Master Value
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0

在PHP日志中获取此错误

PHP Warning:  PHP Startup: imagick: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20121212
ahy6op9u

ahy6op9u1#

可能的解决方案:

Double check the paths and php configuration - you might have the imagick.so file in another directory, not the one php is looking for extensions in ?
1)找到正确的php.ini文件-在你的phpinfo()页面中,它指出了哪个php.ini文件正在使用。
2) Make sure you have imagick.so in proper extension dir (the one php really uses). To check the actual path use:
php-config--扩展目录
3)如果(1)和(2)正常,请在php.ini中启用扩展
扩展名= imagick.so
4)重新启动web服务器,imagick应该存在(加载)在phpinfo()中

备注#1

SO source post
请记住以下内容也适用
您的扩展应该在三个主要属性上与PHP服务器兼容:
1-PHP服务器配置的Zend API编号(在phpinfo()中可以找到这个编号),这个编号应该与构建时的扩展头文件相同。
2-PHP服务器上的编译器版本和扩展必须相同。
3-PHP服务器中的线程安全非常重要。如果使用线程安全服务器,则必须使用php线程安全库构建扩展;如果使用非线程安全服务器,则应使用PHP-nts库构建扩展。

备注2

SO source post
请记住,如果. so文件已损坏,在其他方面不正确(不正确的文件结构)或依赖于丢失或无法加载的文件-扩展名将不会加载并提供。

备注3

注意,"php-m"显示的是编译成php的模块,而不是加载的扩展。请尝试以下内容以获取更详细的信息:
php-i语言

编辑

提供的php错误
使用模块API = 20090626编译的模块
使用模块API = 20121212编译的PHP
清楚地表明您使用了与php不匹配的不正确API版本编译模块。**您需要手动构建PHP扩展。**您最终使用的扩展似乎是针对不同版本的PHP构建的,而不是针对您当前的PHP 5.5。
关于这个主题有很多教程,只要记住使用正确版本的imagick和phpize,这会对你有所帮助:http://wiki.dreamhost.com/ImageMagick_and_imagick_php_module_on_shared_hosting

ftf50wuq

ftf50wuq2#

重新启动php

service php5-fpm restart
rsl1atfo

rsl1atfo3#

在我的例子中,我把它安装在Docker容器中,但是我是从主机运行我的CLI脚本,而主机没有Imagick。

相关问题