PHP Expansion Module Installation
编译httpd时,有涉及动态和静态模块,PHP也一样有静态与动态之分,之前所涉及到的PHP安装都全部为静态,并没有任何动态的模块,所谓动态,就是一个独立存在的.so文件,在httpd中PHP就是以动态模块的形式被加载的。PHP一旦编译完成后,要想再增加一个功能的话,要么重新编译PHP,要么直接编译一个扩展模块(生成一个.so文件),然后在php.ini中配置一下,就可以被加载使用了。1、查看PHP加载的模块[[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//Add the following
Extension = redis.so
[Email protected] phpredis-develop]#/usr/local/php/bin/php-m | grep Redis//See if Redis is loaded
Redis
88.PHP Expansion Module Installation