在 CentOS 7.1 上,我遇到以下错误:
Fatal error: Call to undefined function exif_imagetype() in /some/path/to/a/php.file.php on line XXX
我可以在/usr/local/lib/php.ini
以下行中启用此功能:
870 ;extension=php_mbstring.dll
871 ;extension=php_exif.dll ; Must be after mbstring as it depends on it
但在我的系统上找不到 exif 库!find / -name exif
没有找到任何东西。
当我这样做时yum search
,我得到以下包:
libexif-devel.i686 : Files needed for libexif application development
libexif-devel.x86_64 : Files needed for libexif application development
libexif-doc.x86_64 : The EXIF Library API documentation
exiv2.x86_64 : Exif and Iptc metadata manipulation library
exiv2-libs.i686 : Exif and Iptc metadata manipulation library
exiv2-libs.x86_64 : Exif and Iptc metadata manipulation library
libexif.i686 : Library for extracting extra information from image files
libexif.x86_64 : Library for extracting extra information from image files
我的问题是,如果我删除;
、 将 、 重命名php_exif.dll
为php_mbstring.dll
/ php_mbstring.so
,php_exif.so
我会摆脱这个错误,还是需要安装其中一个软件包?
我对这个软件不熟悉!
答案1
如果你运行:
$ yum provides php-exif
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: repo.bigstepcloud.com
* epel: ftp.heanet.ie
* extras: mirror.sov.uk.goscomb.net
* updates: centos.serverspace.co.uk
php-common-5.4.16-36.el7_1.x86_64 : Common files for PHP
Repo : base
Matched from:
Provides : php-exif
php-common-5.4.16-36.el7_1.x86_64 : Common files for PHP
Repo : @base
Matched from:
Provides : php-exif
你会看到这php-exif
是包的一部分php-common
。如果您已安装,php
那么php-common
将作为依赖项安装。
因此,您应该可以删除分号。
答案2
这是一个足够简单的修复,我阅读并尝试了建议的内容,但它对我的情况不起作用。我所做的只是这样
Yum search exif
结果
*Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
* EA4:
* cpanel-addons-production-feed:
* cpanel-plugins:
* base: centos4.zswap.net
* epel: mirror.team-cymru.com
* extras: centos4.zswap.net
* updates: centos4.zswap.net
================================================ N/S matched: exif ================================================
libexif-devel.i686 : Files needed for libexif application development
libexif-devel.x86_64 : Files needed for libexif application development
libexif-doc.x86_64 : The EXIF Library API documentation
ea-php54-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
ea-php55-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
ea-php56-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
ea-php70-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
ea-php71-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
ea-php72-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
ea-php73-php-exif.x86_64 : A module for PHP applications that need to work with image metadata
exiv2.x86_64 : Exif and Iptc metadata manipulation library
exiv2-libs.i686 : Exif and Iptc metadata manipulation library
exiv2-libs.x86_64 : Exif and Iptc metadata manipulation library
jhead.x86_64 : Tool for displaying EXIF data embedded in JPEG images
libexif.i686 : Library for extracting extra information from image files
libexif.x86_64 : Library for extracting extra information from image files
metadata-extractor2.noarch : Extracts EXIF, IPTC, XMP, ICC and other metadata from image files
nodejs-duplexify.noarch : Turn a writeable and readable stream into a single streams2 duplex stream
perl-Image-ExifTool.noarch : Utility for reading and writing image meta info
renrot.noarch : A program to rename and rotate files according to EXIF tags*
下一个
yum install ea-php73-php-exif.x86_64 -y
就是这样。