ice php 5.6.32,Centos下安装Ice php扩展

安装ICE的方式有两种,一种下载安装包自己编译,一种是通过yum命令进行安装。

因为Ice需要的包比较多,所以编译安装的话比较麻烦,这里我们就只介绍第二种方式,通过yum安装。以下是官方描述:

The Ice run times and developer kits for all supported language mappings (i386 and x86_64).

You can also install Ice using yum by downloading the repository description (zeroc-ice-amzn1.repo) and installing it in /etc/yum.repos.d. Once installed, you can view the available packages using the following command:

# yum list ice* db53* mcpp-devel

Refer to the EC2 documentation for more information.

yum 安装

首先需要添加一个yum源。

# vi /etc/yum.repos.d/zeroc-ice-amzn.repo

写入:

[zeroc-ice]name=Ice 5 for Amazon Linux $releasever - $basearch

baseurl=http://www.zeroc.com/download/Ice/5/el6/$basearchenabled=1gpgcheck=1gpgkey=http://www.zeroc.com/download/RPM-GPG-KEY-zeroc-release

官网上说可以通过

# yum list ice* db53* mcpp-devel

查看安装包列表。真正的安装命令是

# yum install -y ice* db53* mcpp-devel

安装完成可以通过命令搜索文件所在路径:

# find / -name IcePHP.so

源码安装

我的PHP版本是5.4.23,对应安装的Ice版本为3.5.1。

下载Ice源

# cd /opt

# wget http://www.zeroc.com/download/Ice/3.5/Ice-3.5.1.tar.gz

# wget http://www.zeroc.com/download/Ice/3.5/ThirdParty-Sources-3.5.1.tar.gz

安装依赖库

# yum -y install gcc gcc-c++ expat-devel bzip2 bzip2-devel

# yum -y install openssl*

安装ThirdParty-Sources

# tar xvf ThirdParty-Sources-3.5.1.tar.gz

# cd ThirdParty-Sources-3.5.1

# tar xvf mcpp-2.7.2.tar.gz

# cd mcpp-2.7.2

# patch -p0 < ../mcpp/patch.mcpp.2.7.2

# ./configure CFLAGS=-fPIC --enable-mcpplib --disable-shared

# make && make install

# cd ../

安装BerkeleyDB

# tar zxf db-5.3.21.NC.tar.gz

# cd db-5.3.21.NC

# patch -p0 < ../db/patch.db.5.3.21

# cd build_unix

# ../dist/configure --prefix=/usr --enable-cxx

(说明:db的默认安装prefix路径是/usr/local/BerkeleyDB.5.3,需要改为/usr,否则make Ice时会找不到路径)

# make && make install

安装Ice

# cd /opt

# tar xvf Ice-3.5.1.tar.gz

# cd Ice-3.5.1/cpp

# vi config/Make.tules(默认)

根据环境修改config/Make.rules文件(我这里的安装目录是/opt目录,是ICE默认配置的目录,所以不用修改。)

# make && make install

# cd ../

#

# cd php //安装PHP扩展

# vi config/Make.rules.php

PHP_HOME ?= /usr/local/php (修改为你php安装目录)

# make && make install

源码安装完成之后,会在当前目录生成IcePHP.so文件。

找到IcePHP.so文件后,将这个文件复制到php的扩展目录,然后在php.ini添加该扩展即可。

extension=IcePHP.so

启动PHP的时候如果遇到扩展错误:

PHP Startup: Unable to load dynamic library ‘/usr/local/server/php/lib/php/extensions/no-debug-non-zts-20100525/IcePHP.so’ - libIce.so.35: cannot open shared object file: No such file or directory in Unknown on line 0

这个是因为没加载到Ice的so文件导致的,可以使用ldd命令查看IcePHP.so。

# ldd IcePHP.so

linux-vdso.so.1 => (0x00007fff6c1ff000)

libIce.so.35 => not found

libSlice.so.35 => not found

libIceUtil.so.35 => not found

libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fdc30e74000)

libm.so.6 => /lib64/libm.so.6 (0x00007fdc30bef000)

libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fdc309d9000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdc307bc000)

libc.so.6 => /lib64/libc.so.6 (0x00007fdc30427000)

/lib64/ld-linux-x86-64.so.2 (0x00007fdc314a6000)

这里可以看到,libIce.so这几个文件没有查找到。

# export LD_LIBRARY_PATH=/opt/Ice-3.5.1/lib64

# ldd IcePHP.so

linux-vdso.so.1 => (0x00007fffcd5ff000)

libIce.so.35 => /opt/Ice-3.5.1/lib64/libIce.so.35 (0x00007fc9c20f6000)

libSlice.so.35 => /opt/Ice-3.5.1/lib64/libSlice.so.35 (0x00007fc9c1c76000)

libIceUtil.so.35 => /opt/Ice-3.5.1/lib64/libIceUtil.so.35 (0x00007fc9c19fd000)

libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fc9c16ed000)

libm.so.6 => /lib64/libm.so.6 (0x00007fc9c1468000)

libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fc9c1252000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fc9c1035000)

libc.so.6 => /lib64/libc.so.6 (0x00007fc9c0ca0000)

libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fc9c0a8f000)

libdl.so.2 => /lib64/libdl.so.2 (0x00007fc9c088b000)

librt.so.1 => /lib64/librt.so.1 (0x00007fc9c0682000)

/lib64/ld-linux-x86-64.so.2 (0x00007fc9c2d29000)

2014-10-28添加源码安装。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值