测试机上测试一些数据需要用到redis扩展,偷懒yum安装的php,以前yum install php-pecl-redis.x86_64可以安装扩展,这次找不到安装包,不折腾手动安装下。
1.下载phpredis
cd /usr/local/src
wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
tar -zxvf 2.2.4.tar.gz
cd phpredis-2.2.4/
2.用phpize生成configure配置文件
/usr/bin/phpize #会生成几个新文件,默认安装路径自定义的按照自定义路径;
./configure --with-php-config=/usr/bin/php-config
make #编译
make install #安装
make test #测试
3.配置php支持
vim /usr/local/php/etc/php.ini #编辑配置文件,在最后一行添加以下内容
extension="redis.so"
4.
重启http加载查看phpinfo信息:
redis
Redis Supportenabled
Redis Version2.2.4
成功!
php扩展Protobuf
下载protobuf扩展包:wget https://github.com/allegro/php-protobuf/archive/master.zip这个master.zip会报错;
master.zip
cd /home/tools/php-protobuf-master/
phpize
可能会报错php-devel
yum install php-devel
./configure
make && make install
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/lib64/php/modules/
然后再php.ini增加
extension = protocolbuffers.so
重启下http就可以了;
装载protobuff库:
pear channel-discover pear.pollinimini.net
pear install drslump/Protobuf-beta
mcryp扩展:
yum install libmcrypt libmcrypt-devel mcrypt mhash 如果报错找不到补丁的话手动安装;
下载Libmcrypt,mhash,mcrypt安装包
Libmcrypt(libmcrypt-2.5.8.tar.gz):http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91774&release_id=487459
mcrypt(mcrypt-2.6.8.tar.gz ):http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91948&release_id=642101
mhash(mhash-0.9.9.9.tar.gz):http://sourceforge.net/project/showfiles.php?group_id=4286&package_id=4300&release_id=645636
2.先安装Libmcrypt
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
说明:libmcript默认安装在/usr/local
3.再安装mhash
tar -zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make && make install
4.最后安装mcrypt
tar -zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
LD_LIBRARY_PATH=/usr/local/lib ./configure
make && make install
说明:由于在配置Mcrypt时,会找不到libmcrypt的链接库,导致无法编译,因为Libmcrypt的链接库在/usr/local/lib文件夹下。
因次,在配置mcrypt时要加入LD_LIBRARY_PATH=/usr/local/lib导入键接库。
到http://cn.php.net/releases/ 网页下找到自己对应php版本,下载后解压
cd php-5.4.16/ext/mcrypt/
phpize (执行phpize命令(phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块,如果没有?yum install php-devel)
phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
yum 安装php./configure就可以,定制的需要自己的路径如比:./configure --with-php-config=/usr/bin/php-config
./configure
make && make install
Libraries have been installed in:
/home/tools/php-5.4.16/ext/mcrypt/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/lib64/php/modules/
php.ini添加一条extension=mcrypt.so
extension = protocolbuffers.so
extension = mcrypt.so