Imagick未在PHP中加载 [英] Imagick Not Loaded in PHP

查看:158
本文介绍了Imagick未在PHP中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Ubuntu 12.04上安装了Imagick,但仍然可以得到

I have installed Imagick on Ubuntu 12.04 but still i get

找不到"Imagick"类

Class 'Imagick' not found

当我通过终端检查时

php -m

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脚本检查加载的扩展名

but when i check loaded extension through PHP script

get_loaded_extensions()

get_loaded_extensions()

我没有想象力

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日志中获取此错误

getting this error in PHP log

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

推荐答案

可能的解决方案:

仔细检查路径和php配置-您可能将imagick.so文件放在另一个目录中,而不是一个php在寻找扩展名?

Possible solution:

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.

1) Locate the proper php.ini file - in your phpinfo() page it is pointed which php.ini is actually in use.

2)确保在正确的扩展名目录中有imagick.so(一个php真正使用的).要检查实际路径,请使用:

2) Make sure you have imagick.so in proper extension dir (the one php really uses). To check the actual path use:

php-config --extension-dir

php-config --extension-dir

3)如果(1)和(2)正常,请在php.ini中启用扩展名

3) if (1) and (2) are OK, enable the extension in php.ini

extension = imagick.so

extension=imagick.so

4)重新启动Web服务器,imagick应该存在于phpinfo()中(已加载)

4) restart web server, the imagick should be present (loaded) in phpinfo()

SO源帖子

请记住,以下内容同样适用

Bear in mind that the following also apply

您的扩展程序应在三个主要方面与您的PHP服务器兼容 属性:

Your extension should compatible with your PHP server in three main attributes:

1-您的PHP服务器配置的Zend API编号(在 phpinfo(),您可以找到此数字),此数字应相同 在构建时使用扩展头文件.

1- The Zend API number which your PHP server is configured with ( in phpinfo() you can find this number), this number should be the same with your extension header file at build time.

2- PHP服务器和扩展名上的编译器版本必须为 一样.

2- The compiler version on your PHP server and your extension must be the same.

3- PHP服务器中的线程安全性很重要.如果您使用 线程安全的服务器,那么您的扩展必须使用php构建 线程安全的库,如果您使用非线程安全的服务器,则应 用PHP-nts库构建扩展.

3- Thread safety in your PHP server is important. If you use thread-safe server then your extension must be built with php thread-safe library and if you use non-thread safe server you should build your extension with PHP-nts library.

备注#2

SO源帖子

请记住,如果.so文件损坏,以其他方式不正确(文件结构不正确)或取决于丢失或无法加载的文件-该扩展名将无法加载并可用.

Keep in mind that if an .so file is corrupt, is improper in other ways (incorrect file structure) or depends on files that are missing or not available for load - the extension will not be loaded and made available.

请注意,"php -m"显示的是编译为php的模块,而不是已加载的扩展.请尝试以下详细信息:

Note that the "php -m" shows modules compiled into php, not the loaded extensions. Try the below for more detailed information:

php -i

php -i

编辑

提供的php错误

EDIT

The provided php error

使用模块API = 20090626编译的模块
使用模块API = 20121212编译的PHP

Module compiled with module API=20090626
PHP compiled with module API=20121212

清楚地表明您使用错误的API版本编译了模块,该版本与php不匹配. 您将需要手动构建PHP扩展.最终得到的扩展似乎是针对不同版本的PHP构建的,而不是针对当前的PHP 5.5构建的.

clearly indicates that you have the module compiled with improper API version that does not match the php. You will need to build the PHP extension manually. The extension you've ended up with seems to be built against a different version of PHP, not your current PHP 5.5.

有很多与此主题相关的教程,只记得使用imagick和phpize的正确版本.这应该可以帮助您: http://wiki.dreamhost.com/ImageMagick_and_imagick_php_module_on_shared_hosting

There are numerous tutorials concerning this topic, just remember to use the proper version of imagick and phpize. This should help you out: http://wiki.dreamhost.com/ImageMagick_and_imagick_php_module_on_shared_hosting

这篇关于Imagick未在PHP中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆