php 安裝redis,protobuf,mcryp擴展

    測試機上測試一些數據需要用到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




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章