[root@test-a ~]# /usr/local/php/bin/php -m [PHP Modules] bz2 Core ... zlib [Zend Modules]
[root@test-a ~]# cd /usr/local/src/ [root@test-a src]# wget https://codeload.github.com/phpredis/phpredis/zip/develo p --2018-11-22 08:03:30-- https://codeload.github.com/phpredis/phpredis/zip/devel op Resolving codeload.github.com (codeload.github.com)... 13.229.189.0, 54.251.140. 56, 13.250.162.133 Connecting to codeload.github.com (codeload.github.com)|13.229.189.0|:443... con nected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/zip] Saving to: ‘develop’ [ <=> ] 254,651 33.9KB/s in 7.3s 2018-11-22 08:03:45 (34.2 KB/s) - ‘develop’ saved [254651] [root@test-a src]# [root@test-a src]# [root@test-a src]# ls apr-1.6.5 httpd-2.4.37.tar.gz apr-1.6.5.tar.gz mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz apr-util-1.6.1 mariadb-10.3.10-linux-glibc_214-x86_64.tar.gz apr-util-1.6.1.tar.gz mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz develop php-5.6.32 httpd-2.2.9 php-5.6.32.tar.bz2 httpd-2.2.9.tar.gz php-7.1.6 httpd-2.4.37 php-7.1.6.tar.bz2 [root@test-a src]# mv develop phpredis-dev.zip # 重命名 [root@test-a src]# unzip phpredis-dev.zip # 解壓 [root@test-a src]# cd phpredis-develop/ [root@test-a phpredis-develop]# /usr/local/php/bin/phpize Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226 Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. # 提示缺乏autoconf模塊 [root@test-a phpredis-develop]# yum install -y autoconf [root@test-a phpredis-develop]# /usr/local/php/bin/phpize # 生成configure Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226 [root@test-a phpredis-develop]# ls -l config* # 已生成configure -rwxr-xr-x. 1 root root 45079 Nov 22 08:11 config.guess -rw-r--r--. 1 root root 1776 Nov 22 08:11 config.h.in -rwxr-xr-x. 1 root root 4776 Nov 21 19:39 config.m4 -rwxr-xr-x. 1 root root 35782 Nov 22 08:11 config.sub -rwxr-xr-x. 1 root root 451368 Nov 22 08:11 configure -rw-r--r--. 1 root root 4690 Nov 22 08:11 configure.in -rw-r--r--. 1 root root 923 Nov 21 19:39 config.w32
[root@test-a phpredis-develop]# ./configure --with-php-config=/usr/local/php/bin/php-config [root@test-a phpredis-develop]# make && make install [root@test-a phpredis-develop]# /usr/local/php/bin/php -i |grep extension_dir # 查看擴展模塊存放目錄,能夠在php.ini中去自定義該路徑 extension_dir => /usr/local/php/lib/php/extensions/no-debug-zts-20131226 => /usr/local/php/lib/php/extensions/no-debug-zts-20131226 [root@test-a phpredis-develop]# vim /usr/local/php/etc/php.ini # 添加extension=redis.so [root@test-a phpredis-develop]# /usr/local/php/bin/php -m|grep redis redis
[root@test-a phpredis-develop]# ls /usr/local/src/php-5.6.32/ext/ bcmath fileinfo mbstring pdo_firebird shmop tokenizer bz2 filter mcrypt pdo_mysql simplexml wddx calendar ftp mssql pdo_oci skeleton xml com_dotnet gd mysql pdo_odbc snmp xmlreader ctype gettext mysqli pdo_pgsql soap xmlrpc curl gmp mysqlnd pdo_sqlite sockets xmlwriter date hash oci8 pgsql spl xsl dba iconv odbc phar sqlite3 zip dom imap opcache posix standard zlib enchant interbase openssl pspell sybase_ct ereg intl pcntl readline sysvmsg exif json pcre recode sysvsem ext_skel ldap pdo reflection sysvshm ext_skel_win32.php libxml pdo_dblib session tidy
擴展包查找下載地址: http://pecl.php.net/php