当前位置:   article > 正文

exif linux php扩展_Linux安装PHP扩展模块详解

linux安装php exif扩展

PHP扩展模块安装

编译httpd时,有涉及动态和静态模块,PHP也一样有静态与动态之分,之前所涉及到的PHP安装都全部为静态,并没有任何动态的模块,所谓动态,就是一个独立存在的.so文件,在httpd中PHP就是以动态模块的形式被加载的。PHP一旦编译完成后,要想再增加一个功能的话,要么重新编译PHP,要么直接编译一个扩展模块(生成一个.so文件),然后在php.ini中配置一下,就可以被加载使用了。

1.查看PHP加载了哪些模块

[root@linuxmi ~]# /usr/local/php/bin/php -m

[PHP Modules]

bz2

Core

ctype

date

dom

ereg

exif

fileinfo

filter

gd

hash

iconv

json

libxml

mbstring

mcrypt

mysql

mysqli

openssl

pcre

PDO

pdo_mysql

pdo_sqlite

Phar

posix

Reflection

session

SimpleXML

soap

sockets

SPL

sqlite3

standard

tokenizer

xml

xmlreader

xmlwriter

zlib

[Zend Modules]

2.安装一个PHP的redis扩展模块。

[root@linuxmi ~]# cd /usr/local/src/

[root@linuxmi src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop

[root@linuxmi src]# mv develop phpredis-develop.zip

[root@linuxmi src]# unzip phpredis-develop.zip //yum install -y unzip

[root@linuxmi src]# cd phpredis-develop

[root@linuxmi phpredis-develop]#

[root@linuxmi src]# cd phpredis-develop

[root@linuxmi phpredis-develop]# /usr/local/php7/bin/phpize //生成configure文件

Configuring for:

PHP Api Version: 20160303

Zend Module Api No: 20160303

Zend Extension Api No: 320160303

Cannot find autoconf. Please check your autoconf installation and the

$PHP_AUTOCONF environment variable. Then, rerun this script.

[root@linuxmi phpredis-develop]# yum install -y autoconf

[root@linuxmi phpredis-develop]# /usr/local/php7/bin/phpize

Configuring for:

PHP Api Version: 20160303

Zend Module Api No: 20160303

Zend Extension Api No: 320160303

[root@linuxmi phpredis-develop]# ls

acinclude.m4 cluster_library.h config.sub CREDITS library.c mkdeb.sh redis_array.h redis_commands.c serialize.list

aclocal.m4 cluster.markdown configure debian library.h mkinstalldirs redis_array_impl.c redis_commands.h tests

arrays.markdown common.h configure.in debian.control ltmain.sh package.xml redis_array_impl.h redis_session.c

autom4te.cache config.guess config.w32 install-sh Makefile.global php_redis.h redis.c redis_session.h

build config.h.in COPYING ISSUE_TEMPLATE.md missing README.markdown redis_cluster.c rpm

cluster_library.c config.m4 crc16.h liblzf mkdeb-apache2.sh redis_array.c redis_cluster.h run-tests.php

[root@linuxmi phpredis-develop]# ./configure --with-php-config=/usr/local/php7/bin/php-config

[root@linuxmi phpredis-develop]# echo $?

0

[root@linuxmi phpredis-develop]# make

[root@linuxmi phpredis-develop]# echo $?

0

[root@linuxmi phpredis-develop]# make install

Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/

[root@linuxmi phpredis-develop]# ls /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/

opcache.so redis.so

[root@linuxmi phpredis-develop]# /usr/local/php7/bin/php -m

[PHP Modules]

bz2

Core

ctype

date

dom

exif

fileinfo

filter

gd

hash

iconv

json

libxml

mbstring

mcrypt

mysqli

openssl

pcre

PDO

pdo_mysql

pdo_sqlite

Phar

posix

Reflection

session

SimpleXML

soap

sockets

SPL

sqlite3

standard

tokenizer

xml

xmlreader

xmlwriter

zlib

[Zend Modules]

[root@linuxmi phpredis-develop]# /usr/local/php7/bin/php -m |grep redis

[root@linuxmi phpredis-develop]# /usr/local/php/bin/php -i |grep extension_dir //查看扩展模块存放目录,我们可以在php.ini中去自定义该路径

PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0

extension_dir => /usr/local/php/lib/php/extensions/no-debug-zts-20131226 => /usr/local/php/lib/php/extensions/no-debug-zts-20131226

sqlite3.extension_dir => no value => no value

[root@linuxmi phpredis-develop]# vim /usr/local/php7/etc/php.ini //增加一行配置(可以放到文件最后一行)

定义如下:

extension = redis.so

[root@linuxmi phpredis-develop]# /usr/local/php7/bin/php -m |grep redis

redis

增加示例图:

报错:

缺少autoconf包,安装yum install -y autoconf

这个不影响使用,如果要去掉它,可以在php.ini里设置一下timezone那个参数

举例:

你想编译一个扩展模块的时候,如果它自带的源码包ext下有这个目录,那就可以直接在目录下编译它,如果没有那就需要去官网下载,下面是给大家举例一个zip模块实验操作如下:

[root@linuxmi ~]# cd /usr/local/src/php-7.1.6

[root@linuxmi php-7.1.6]# ls

acinclude.m4 configure install-sh Makefile.global php.gif README.RELEASE_PROCESS server-tests.php

aclocal.m4 configure.in libphp7.la Makefile.objects php.ini-development README.SELF-CONTAINED-EXTENSIONS snapshot

appveyor CONTRIBUTING.md libs makerpm php.ini-production README.STREAMS stamp-h.in

build CREDITS libtool meta_ccld README.EXT_SKEL README.SUBMITTING_PATCH stub.c

buildconf ext LICENSE missing README.GIT-RULES README.TESTING tests

buildconf.bat EXTENSIONS ltmain.sh mkinstalldirs README.input_filter README.TESTING2 travis

CODING_STANDARDS footer main modules README.MAILINGLIST_RULES README.UNIX-BUILD-SYSTEM TSRM

config.guess generated_lists makedist netware README.md README.WIN32-BUILD-SYSTEM UPGRADING

config.log genfiles Makefile NEWS README.namespaces run-tests.php UPGRADING.INTERNALS

config.nice header Makefile.frag pear README.NEW-OUTPUT-API sapi vcsclean

config.status include Makefile.fragments php7.spec README.PARAMETER_PARSING_API scripts win32

config.sub INSTALL Makefile.gcov php7.spec.in README.REDIST.BINS server-tests-config.php Zend

[root@linuxmi php-7.1.6]# cd ext/

[root@linuxmi ext]# ls

bcmath date ext_skel_win32.php gmp json mysqlnd pcre pdo_odbc pspell simplexml sqlite3 tokenizer xsl

bz2 dba fileinfo hash ldap oci8 pdo pdo_pgsql readline skeleton standard wddx zip

calendar dom filter iconv libxml odbc pdo_dblib pdo_sqlite recode snmp sysvmsg xml zlib

com_dotnet enchant ftp imap mbstring opcache pdo_firebird pgsql reflection soap sysvsem xmlreader

ctype exif gd interbase mcrypt openssl pdo_mysql phar session sockets sysvshm xmlrpc

curl ext_skel gettext intl mysqli pcntl pdo_oci posix shmop spl tidy xmlwriter

[root@linuxmi ext]# /usr/local/php7/bin/php -m |grep zip

[root@linuxmi ext]# cd zip/

[root@linuxmi zip]# ls

config.m4 config.w32 CREDITS examples lib LICENSE_libzip php_zip.c php_zip.h tests TODO zip_stream.c

[root@linuxmi zip]# /usr/local/php7/bin/phpize

Configuring for:

PHP Api Version: 20160303

Zend Module Api No: 20160303

Zend Extension Api No: 320160303

[root@linuxmi zip]# ./configure --with-php-config=/usr/local/php7/bin/php-config

[root@linuxmi zip]# make

[root@linuxmi zip]# echo $?

0

[root@linuxmi zip]# make install

Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/

[root@linuxmi zip]# ls /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/

opcache.so redis.so zip.so

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/运维做开发/article/detail/988956
推荐阅读
相关标签
  

闽ICP备14008679号