11.32 PHP expansion Module Ann
installed
• View PHP Modules
/usr/local/php7/bin/php-m
Forget installation or requirements change, need to add module
Install a Redis module below (typically used as a cache for the lamp architecture)
[[email protected] php-7.1.6]# cd /usr/local/src/[[email protected] src]# Wget https://codeload.github.com/phpredis/phpredis/zip/develop (procedure omitted) [[email protected] src]# mv develop phpredis-develop.zip ## renaming [[Email protected] src]# unzip phpredis-develop.zip (procedure omitted) [[email protected] Phpredis-develop]# yum install -y autoconf (procedure omitted) [[email protected] phpredis-develop]# /usr/local/php7/bin/phpize # #生成. configureconfiguring for:php api version: 20160303zend module api no: 20160303zend extension Api No: 320160303[[email protected] phpredis-develop]# Lsacinclude.m4 cluster.markdown configure.in install-sh missing redis_array.c redis_commands.c testsaclocal.m4 common.h config.w32 ISSUE_TEMPLATE.md mkdeb-apache2.sh redis_array.h redis_commands.harrays.markdown config.guess COPYING liblzf mkdeb.sh redis_array_impl.c redis_session.cautom4te.cache Config.h.in crc16.h library.c mkinstalldirs redis_array_impl.h redis_session.hbuild config.m4 CREDITS library.h package.xml redis.c rpmcluster_library.c config.sub debian ltmain.sh php_redis.h redis_cluster.c run-tests.pHpcluster_library.h configure debian.control Makefile.global README.markdown redis_cluster.h serialize.list[[email protected] phpredis-develop]# ./configure -- With-php-config=/usr/local/php7/bin/php-config (omitted from the compilation process) [[email protected] phpredis-develop]# Make && make install (procedure omitted) installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
Make install will put redis.so in/usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
[Email protected] phpredis-develop]# ls/usr/local/php7/lib/php/extensions/no-debug-zts-20160303/opcache.so Redis.so
(PHP does not support Redis yet, requires loading redis.so)
• View the extension Module storage directory, we can customize the path in php.ini
[Email protected] phpredis-develop]#/usr/local/php7/bin/php-i |grep-i extension_dirextension_dir =/usr/local/ php7/lib/php/extensions/no-debug-zts-20160303 =/usr/local/php7/lib/php/extensions/ No-debug-zts-20160303sqlite3.extension_dir = no value = no value
Edit/usr/local/php7/etc/php.ini, add a line of configuration (can be placed on the last line of the file)
Extension = redis.so
[Email protected] phpredis-develop]#/usr/local/php7/bin/php-m |grep Redisredis
If you want to compile a module, if the PHP source package in the Ext folder comes with the directory, then you can directly compile without downloading, if not, then need to download
There are many modules in the PHP source package, we install a zip module that is not loaded
[[Email protected] src]# cd php-7.1.6/ext/[[email protected] ext]# lsbcmath dba filter imap mcrypt pcntl pdo_odbc readline snmp sysvsem xmlrpcbz2 dom ftp interbase mysqli pcre pdo_pgsql recode soap sysvshm xmlwritercalendar enchant gd intl mysqlnd pdo pdo_sqlite Reflection sockets tidy xslcom_dotnet exif gettext json oci8 pdo_ dblib pgsql session spl tokenizer zipctype ext_skel gmp ldap odbc pdo_firebird phar shmop sqlite3 wddx zlibcurl Ext_skel_win32.php hash libxml opcache pdo_mysql posix simplexml standard xmldate fileinfo iconv mbstring openssl pdo_oci pspell skeleton sysvmsg xmlreader[[email protected] ext ]# /usr/local/php7/bin/php -m |grep zip ## No zip module [[email protected] ext]# cd zip/[[email protected] zip]# lsconfig.m4 config.w32 CREDITS examples lib LICENSE_libzip php_zip.c php_zip.h tests TODO zip_stream.c[[email protected] zip]# /usr/local/php7/bin/phpize # #执行, generating ./configureconfiguring for:php api version: 20160303Zend Module Api No: 20160303zend extension api no: 320160303[[email protected] zip ]# lsacinclude.m4 build Config.m4 configure.in examples license_libzip missing php_zip.h TODOaclocal.m4 config.guess config.sub config.w32 install-sh ltmain.sh mkinstalldirs run-tests.php zip_stream.cautom4te.cache config.h.in configure credits lib Makefile.global php_zip.c tests[[email protected] zip] # ./configure --with-php-config=/usr/local/php7/bin/php-config (omitted from the compilation process) [[email protected] zip]# make && make install[[email protected] zip]# ls /usr/ local/php7/lib/php/extensions/no-debug-zts-20160303redis.so zip.so[[email protected] zip]# vim /usr/local/ Php7/etc/php.iniextension=zip.so/usr/local/php7/bin/php -m |grep zipzip
2018-3-8 11 weeks 3 Lessons PHP expansion module installation