PHP Expansion Module Installation

Source: Internet
Author: User
Tags soap mcrypt spl php redis posix zts zend

PHP Expansion Module installation

When compiling httpd, there are dynamic and static modules involved, PHP also has static and dynamic points, the previous PHP installation is all static, and there is no dynamic module, so-called dynamic, is an independent existence of the. so file, in httpd PHP is loaded in the form of dynamic modules. Once PHP is compiled, if you want to add another feature, either recompile PHP or simply compile an extension (generate a. so file) and then configure it in php.ini to be loaded and used.


1. See which modules are loaded by PHP

[Email protected] ~]#/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. Install a php redis extension module.

[Email protected] ~]# cd/usr/local/src/

[Email protected] src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop

[Email protected] src]# MV Develop Phpredis-develop.zip

[Email protected] src]# Unzip Phpredis-develop.zip//yum install-y Unzip

[Email protected] src]# CD Phpredis-develop

[Email protected] phpredis-develop]#

[Email protected] src]# CD Phpredis-develop

[[email protected] phpredis-develop]#/usr/local/php7/bin/phpize//Generate Configure File

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 the this script.

[email protected] phpredis-develop]# Yum install-y autoconf

[Email protected] phpredis-develop]#/usr/local/php7/bin/phpize

Configuring for:

PHP Api version:20160303

Zend Module Api no:20160303

Zend Extension Api no:320160303

[[email protected] 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

[Email protected] phpredis-develop]#/configure--with-php-config=/usr/local/php7/bin/php-config

[[email protected] phpredis-develop]# echo $?

0

[[email protected] phpredis-develop]# make

[[email protected] phpredis-develop]# echo $?

0

[[email protected] phpredis-develop]# make install

Installing Shared extensions:/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

[Email protected] 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]

[Email protected] phpredis-develop]#/usr/local/php7/bin/php-m |grep Redis

[[email protected] phpredis-develop]#/usr/local/php/bin/php-i |grep extension_dir//View expansion Module Storage directory, we can customize the path in php.ini

PHP Warning:Unknown:It is not safe for rely on the system ' s timezone settings. You is *required* to use the Date.timezone setting or the Date_default_timezone_set () function. In case you used any of those methods and you is still getting this warning, your most likely misspelled the timezone Iden Tifier. 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

[[email protected] phpredis-develop]# Vim/usr/local/php7/etc/php.ini//Add a line of configuration (can be placed on the last line of the file)


Defined as follows:

Extension = redis.so


[Email protected] phpredis-develop]#/usr/local/php7/bin/php-m |grep Redis

Redis


Add an example diagram:


Error:

Missing autoconf package, install Yum install-y autoconf


This does not affect the use, if you want to remove it, you can set the timezone that parameter in the php.ini



Example:

You want to compile an extension module, if it comes with the source code package ext has this directory, it can be directly in the directory to compile it, if not it will need to download the official website, here are examples of a ZIP module experiment operation as follows:


[Email protected] ~]# cd/usr/local/src/php-7.1.6

[[email protected] 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

[Email protected] php-7.1.6]# CD ext/

[[email protected] ext]# ls

Bcmath date ext_skel_win32.php GMP json mysqlnd pcre pdo_odbc Pspell simplexml s Qlite3 Tokenizer XSL

BZ2 dba FileInfo Hash LDAP oci8 PDO pdo_pgsql ReadLine skeleton s Tandard wddx Zip

Calendar DOM Filter Iconv libxml ODBC pdo_dblib pdo_sqlite Recode SNMP s ysvmsg XML zlib

Com_dotnet enchant FTP IMAP mbstring opcache pdo_firebird pgsql Reflection soap S Ysvsem XmlReader

CType Exif gd InterBase MCrypt OpenSSL pdo_mysql Phar Session sockets s Ysvshm Xmlrpc

Curl Ext_skel GetText Intl mysqli pcntl pdo_oci POSIX shmop SPL t Idy XmlWriter

[Email protected] ext]#/usr/local/php7/bin/php-m |grep zip

[Email protected] ext]# CD zip/

[[email protected] zip]# ls

CONFIG.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

Configuring for:

PHP Api version:20160303

Zend Module Api no:20160303

Zend Extension Api no:320160303

[Email protected] zip]#/configure--with-php-config=/usr/local/php7/bin/php-config

[[email protected] zip]# make

[[email protected] zip]# echo $?

0

[[email protected] zip]# make install

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

[Email protected] zip]# ls/usr/local/php7/lib/php/extensions/no-debug-zts-20160303/

opcache.so redis.so zip.so


PHP Expansion Module Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.