[TOC]
PHP expansion Module installation download Install Redis
Redis is used as a cache under lamp!
1. Download and switch to the specified directory:
cd /usr/local/src/wget https://codeload.github.com/phpredis/phpredis/zip/develop mv develop phpredis-develop.zip //改名unzip phpredis-develop.zip //解压缩cd phpredis-develop
2. Generate Configure:
/usr/local/php7/bin/phpize //生成configure文件
Sometimes the installation will go wrong, missing a package autoconf
[[email protected] phpredis-develop]# yum install -y autoconf
Regenerate Configure
[[email protected] phpredis-develop]# /usr/local/php7/bin/phpizeConfiguring for:PHP Api Version: 20160303Zend Module Api No: 20160303Zend Extension Api No: 320160303
3. Compile the configuration:
[[email protected] phpredis-develop]# ./configure --with-php-config=/usr/local/php7/bin/php-config
4. Installation test:
makemake installls /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/opcache.so redis.so
Then there will be redis.so this plugin! This is the expansion module we need.
[[email protected] phpredis-develop]# make installInstalling 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
5. See if PHP supports Redis:/usr/local/php7/bin/php-m |grep Redis
[[email protected] phpredis-develop]# /usr/local/php7/bin/php -m[PHP Modules]bz2CorectypedatedomexiffileinfofiltergdhashiconvjsonlibxmlmbstringmcryptmysqliopensslpcrePDOpdo_mysqlpdo_sqlitePharposixReflectionsessionSimpleXMLsoapsocketsSPLsqlite3standardtokenizerxmlxmlreaderxmlwriterzlib[Zend Modules]
Not supported, find module path
[[email protected] phpredis-develop]# /usr/local/php7/bin/php -m |grep redis
6. Find Extension_dir, 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 extension_dir extension_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
7. Adding modules manually
[[email protected] phpredis-develop]# vim /usr/local/php7/etc/php.ini
Search/extension
Extension = redis.so
[[email protected] phpredis-develop]# vim /usr/local/php7/etc/php.ini [[email protected] phpredis-develop]# /usr/local/php7/bin/php -m |grep redisredis
2. Compile your own PHP source package
In fact, in the PHP7 source package, there are many self-contained source packages. We do not need to download again, directly compiled can!
[[email protected] phpredis-develop]# cd/usr/local/src/php-7.1.6/[[email protected] php-7.1.6]# CD ext/[[ Email protected] ext]# Lsbcmath FileInfo libxml Pdo_firebird session tidybz2 F Ilter mbstring pdo_mysql shmop tokenizercalendar ftp mcrypt pdo_oci simplexml Wddxcom_dotnet gd mysqli pdo_odbc skeleton xmlctype gettext mysqlnd Pdo_pg SQL SNMP xmlreadercurl GMP oci8 pdo_sqlite soap Xmlrpcdate H Ash ODBC Pgsql sockets XMLWRITERDBA iconv Opcache Phar SPL Xsldom IMAP OpenSSL POSIX sqlite3 zipenchant interbase pcntl Pspell Standard Zlibexif Intl pcre readline Sysvmsgext_skel JSON PDO Recode Sysvsemext_skel_win32.php LDAP Pdo_dblib Reflection Sysvshm
Then we will find a lot of our own source packages,
1. First we confirm a zip package,
[[email protected] ext]# /usr/local/php7/bin/php -m |grep zip[[email protected] ext]# cd zip/[[email protected] zip]# lsconfig.m4 CREDITS lib php_zip.c tests zip_stream.cconfig.w32 examples LICENSE_libzip php_zip.h TODO
2. If we need to compile a zip, first go to the zip directory. Then enter:
[[email protected] zip]# /usr/local/php7/bin/phpize Configuring for:PHP Api Version: 20160303Zend Module Api No: 20160303Zend Extension Api No: 320160303[[email protected] zip]# ./configure --with-php-config=/usr/local/php7/bin/php-config
3.make;make Install
[[email protected] zip]# make installInstalling 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
Part of the reprint Source: PHP Extension Module Installation-Laoqi ' s Blog
Useful extensions:
Apache Rewrite tutorial http://coffeelet.blog.163.com/blog/static/13515745320115842755199/
Http://www.cnblogs.com/top5/archive/2009/08/12/1544098.html
Apache rewrite appears dead Loop http://ask.apelearn.com/question/1043
PHP error log level reference http://ask.apelearn.com/question/6973
PHP Open Short Tag http://ask.apelearn.com/question/120
PHP.ini detailed http://legolas.blog.51cto.com/2682485/493917
PHP Expansion Module Installation