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. View PHP-loaded modules
[[email protected] ~]# /usr/local/php/bin/php -m[PHP Modules]bz2CorectypedatedomeregexiffileinfofiltergdhashiconvjsonlibxmlmbstringmcryptmysqlmysqliopensslpcrePDOpdo_mysqlpdo_sqlitePharposixReflectionsessionSimpleXMLsoapsocketsSPLsqlite3standardtokenizerxmlxmlreaderxmlwriterzlib[Zend Modules]
2. Install a PHP extension Module (Redis 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 [[email protected] src]# CD phpredis-develop/[[email protected] phpredis-develop]#/usr/local/php/bin/phpize//purpose is to generate configure file configuring for:php Api Version:20131106zend Module API No:20131226zend Extension API No:220131226cannot find autoconf. Please check your autoconf installation and THE$PHP_AUTOCONF environment variable. Then, the rerun this script.//error cannot find autoconf, need to install some autoconf[[email protected] phpredis-develop]# yum Install- Y autoconf[[email protected] phpredis-develop]#/usr/local/php/bin/phpize configuring For:PHP Api version:20 131106Zend Module API No:20131226zend Extension API no:220131226[[email protected] phpredis-develop]#./conf Igure--with-php-cOnfig=/usr/local/php/bin/php-config[[email protected] phpredis-develop]# make[[email protected] phpredis-develop]# make installinstalling shared extensions:/usr/local/php/lib/php/extensions/ No-debug-zts-20131226///make install will put the compiled Redis into this directory, which is the directory for the extension module [[email protected] phpredis-develop]#/ Usr/local/php/bin/php-i | Grep-i Extension_dirextension_dir =/usr/local/php/lib/php/extensions/no-debug-zts-20131226 =/usr/local/ Php/lib/php/extensions/no-debug-zts-20131226sqlite3.extension_dir = no value + No value//View the expansion module catalog, You can also modify the directory in php.ini [[email protected] phpredis-develop]# ls/usr/local/php/lib/php/extensions/ No-debug-zts-20131226/opcache.so redis.so
3. Modify the PHP configuration file to make the extension effective
[[email protected] phpredis-develop]# vim /usr/local/php/etc/php.ini //添加以下内容extension = redis.so[[email protected] phpredis-develop]# /usr/local/php/bin/php -m | grep redis //查看是否加载了redisredis
PHP Dynamic Expansion Module installation