今日应开发需求,想要显示图片的属性信息,于是度娘就告知exif模块可以实现,操作步骤与问题总结吐下;@H_502_1@
一、环境介绍@H_502_1@
[root@ghzz~]#cat/etc/redhat-release CentOSrelease6.5(Final) Youhavenewmailin/var/spool/mail/root [root@ghzz~]#PHP-v ZendGuardLoaderrequiresZendEngineAPIversion220121212. TheZendEngineAPIversion220131226whichisinstalled,isnewer. ContactZendTechnologiesathttp://www.zend.com/foralaterversionofZendGuardLoader. PHP5.6.14(cli)(built:Jul7201612:43:11) Copyright(c)1997-2015ThePHPGroup ZendEnginev2.6.0,Copyright(c)1998-2015ZendTechnologies withZendOPcachev7.0.6-dev,Copyright(c)1999-2015,byZendTechnologies
二、查找模块@H_502_1@
方法一:去PHP安装路径下ext目录下都是模块@H_502_1@
cd /root/software/PHP-5.6.14/ext/exif@H_502_1@
###这个模块,应该是PHP安装包内自带的,但是./configure编译安装的时候没有加载的包@H_502_1@
PHP官网地址:http://pecl.php.net/packages.php@H_502_1@
@H_502_1@
三、编译安装 (加载模块)@H_502_1@
[root@ghzzlsolesen-pel-56d1b7f]#cd/root/software/PHP-5.6.14/ext/exif [root@ghzzexif]#ll 总用量196 -rw-r--r--1100010003339月302015config.m4 -rw-r--r--1100010003089月302015config.w32 -rw-r--r--110001000369月302015CREDITS -rw-r--r--1100010004969月302015example.PHP -rw-r--r--1100010001453319月302015exif.c -rw-r--r--11000100049339月302015exif.dsp -rw-r--r--11000100019539月302015package.xml -rw-r--r--11000100014639月302015PHP_exif.h -rw-r--r--110001000299月302015test.PHP drwxr-xr-x21000100040969月302015tests -rw-r--r--110001000112329月302015test.txt
[root@ghzzexif]#/usr/local/PHP/bin/PHPize Configuringfor: PHPApiVersion:20131106 ZendModuleApiNo:20131226 ZendExtensionApiNo:220131226 [root@ghzzexif]#./configure-with-PHP-config=/usr/local/PHP/bin/PHP-config checkingforgrepthathandleslonglinesand-e.../bin/grep #。。。省略若干字段 checkingwhetherstrippinglibrariesispossible...yes checkingiflibtoolsupportssharedlibraries...yes checkingwhethertobuildsharedlibraries...yes checkingwhethertobuildstaticlibraries...no creatinglibtool appendingconfigurationtag"CXX"tolibtool configure:creating./config.status config.status:creatingconfig.h [root@ghzzexif]#make&&makeinstall /bin/sh/root/software/PHP-5.6.14/ext/exif/libtool--mode=compilecc-I.-I/root/software/PHP-5.6.14/ext/exif-DPHP_ATOM_INC-I/root/software/PHP-5.6.14/ext/exif/include-I/root/software/PHP-5.6.14/ext/exif/main-I/root/software/PHP-5.6.14/ext/exif-I/usr/local/PHP/include/PHP-I/usr/local/PHP/include/PHP/main-I/usr/local/PHP/include/PHP/TSRM-I/usr/local/PHP/include/PHP/Zend-I/usr/local/PHP/include/PHP/ext-I/usr/local/PHP/include/PHP/ext/date/lib-DHAVE_CONFIG_H-g-O2-c/root/software/PHP-5.6.14/ext/exif/exif.c-oexif.lo mkdir.libs cc-I.-I/root/software/PHP-5.6.14/ext/exif-DPHP_ATOM_INC-I/root/software/PHP-5.6.14/ext/exif/include-I/root/software/PHP-5.6.14/ext/exif/main-I/root/software/PHP-5.6.14/ext/exif-I/usr/local/PHP/include/PHP-I/usr/local/PHP/include/PHP/main-I/usr/local/PHP/include/PHP/TSRM-I/usr/local/PHP/include/PHP/Zend-I/usr/local/PHP/include/PHP/ext-I/usr/local/PHP/include/PHP/ext/date/lib-DHAVE_CONFIG_H-g-O2-c/root/software/PHP-5.6.14/ext/exif/exif.c-fPIC-DPIC-o.libs/exif.o /bin/sh/root/software/PHP-5.6.14/ext/exif/libtool--mode=linkcc-DPHP_ATOM_INC-I/root/software/PHP-5.6.14/ext/exif/include-I/root/software/PHP-5.6.14/ext/exif/main-I/root/software/PHP-5.6.14/ext/exif-I/usr/local/PHP/include/PHP-I/usr/local/PHP/include/PHP/main-I/usr/local/PHP/include/PHP/TSRM-I/usr/local/PHP/include/PHP/Zend-I/usr/local/PHP/include/PHP/ext-I/usr/local/PHP/include/PHP/ext/date/lib-DHAVE_CONFIG_H-g-O2-oexif.la-export-dynamic-avoid-version-prefer-pic-module-rpath/root/software/PHP-5.6.14/ext/exif/modulesexif.lo cc-shared.libs/exif.o-Wl,-soname-Wl,exif.so-o.libs/exif.so creatingexif.la (cd.libs&&rm-fexif.la&&ln-s../exif.laexif.la) /bin/sh/root/software/PHP-5.6.14/ext/exif/libtool--mode=installcp./exif.la/root/software/PHP-5.6.14/ext/exif/modules cp./.libs/exif.so/root/software/PHP-5.6.14/ext/exif/modules/exif.so cp./.libs/exif.lai/root/software/PHP-5.6.14/ext/exif/modules/exif.la PATH="$PATH:/sbin"ldconfig-n/root/software/PHP-5.6.14/ext/exif/modules ---------------------------------------------------------------------- Librarieshavebeeninstalledin: /root/software/PHP-5.6.14/ext/exif/modules Ifyoueverhappentowanttolinkagainstinstalledlibraries inagivendirectory,LIBDIR,youmusteitheruselibtool,and specifythefullpathnameofthelibrary,orusethe`-LLIBDIR' flagduringlinkinganddoatleastoneofthefollowing: -addLIBDIRtothe`LD_LIBRARY_PATH'environmentvariable duringexecution -addLIBDIRtothe`LD_RUN_PATH'environmentvariable duringlinking -usethe`-Wl,--rpath-Wl,LIBDIR'linkerflag -haveyoursystemadministratoraddLIBDIRto`/etc/ld.so.conf' Seeanyoperatingsystemdocumentationaboutsharedlibrariesfor moreinformation,suchastheld(1)andld.so(8)manualpages. ---------------------------------------------------------------------- Buildcomplete. Don'tforgettorun'maketest'. Installingsharedextensions:/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20131226/ [root@ghzzexif]#vi/usr/local/PHP/etc/PHP.ini 查找:extension=再最后一个extension=后面添加上extension=“exif.so” [root@ghzzext]#grep-n"exif.so"/usr/local/PHP/etc/PHP.ini 743:extension="exif.so" [root@ghzzexif]#/etc/init.d/PHP-fpmrestart##重启加载PHP模块
[root@ghzzext]#PHP-m|grepexif exif原文链接:https://www.f2er.com/centos/377192.html