当前位置: 首页 > 工具软件 > Zeroc ICE > 使用案例 >

PHP 安装 zero ice

鲁俊友
2023-12-01

点击查看LNMP环境安装

官网安装

打开 https://zeroc.com/downloads/ice#redhat 选对应的系统,我这里是Centos 7

# 配置 yum
cd /etc/yum.repos.d
sudo wget https://zeroc.com/download/Ice/3.7/el7/zeroc-ice3.7.repo

# Install Ice for C++, Python, PHP, and all Ice services.
sudo yum install ice-all-runtime ice-all-devel

# 查看 php 的模块安装是否成功,成功则有 ice 模块
php -m

源码安装

很不幸这里报错了,so 只有麻烦点自己编译安装
本例错误如下:

PHP Warning:  PHP Startup: Unable to load dynamic library 'ice.so' (tried: /usr/lib64/php/modules/ice.so (/usr/lib64/php/modules/ice.so: undefined symbol: zval_used_for_init), /usr/lib64/php/modules/ice.so.so (/usr/lib64/php/modules/ice.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.16 (cli) (built: Mar 10 2019 21:22:49) ( NTS )

git 下载源码

yum install git -y   # 安装git,如有忽略

git clone -b 3.7 https://github.com/zeroc-ice/ice.git

依赖安装

yum install lmdb-devel
yum install mcpp-devel
yum install gcc-c++ 
yum install libdb-cxx-devel
yum install openssl-devel
yum install bzip2-devel
yum install expat-devel

编译 cpp

cd ice/cpp

# 编译,时间比较久,有报错可能需要安装对应依赖
make V=1 -j8 srcs

# 安装  会自动生成文件夹 /opt/Ice-3.7.2
make install

ll /opt/Ice-3.7.2/bin
export PATH=/opt/Ice-3.7.2/bin:$PATH

# /etc/ld.so.conf.d/ 下面复制一个配置文件
cp /etc/ld.so.conf.d/mariadb-x86_64.conf /etc/ld.so.conf.d/ice_64.conf

echo /opt/Ice-3.7.2/lib64 > /etc/ld.so.conf.d/ice_64.conf

# 刷新 ld 的配置
ldconfig

编译 php 扩展

cd ../php
make && make install

cp /opt/Ice-3.7.2/php/ice.so /usr/lib64/php/modules/ice.so

# 如果 ini 文件没有就生成一下
echo extension=ice.so > /etc/php.d/ice.ini

# 查看模块安装情况
php -m

# 重启 php-fpm
systemctl restart php-fpm

转载于:https://www.cnblogs.com/gromm/p/php-ice-installation.html

 类似资料: