一、下载安装源码包
ZeroMQ源码包下载地址:
http://zeromq.org/area:download
如:zeromq-4.1.4.tar.gz
php的zmq扩展源码包
https://pecl.php.net/package/zmq
或如下地址:
https://github.com/mkoppanen/php-zmq
如:zmq-1.1.3.tgz
二、安装目录
ZeroMQ安装目录 /data/zeromq php安装目录 /data/nmp/php
三、安装ZeroMQ
> tar zxvf zeromq-4.1.4.tar.gz > cd zeromq-4.1.4 > ./autogen.sh > ./configure --prefix=/data/zeromq > make && make install > ldconfig
如果出现如下问题:
No package ‘libsodium‘ found
请到如下网址下载libsodium并安装
https://github.com/jedisct1/libsodium
> cd libsodium-master/ > ./autogen.sh > ./configure > make && make install > ldconfig > vi /root/.bashrc
#添加如下信息 export sodium_CFLAGS="-I/usr/local/include" export sodium_LIBS="-L/usr/local/lib" export CPATH=/usr/local/include export LIBRARY_PATH=/usr/local/lib export LD_LIBRARY_PATH=/usr/local/lib export LD_RUN_PATH=/usr/local/lib export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig export CFLAGS=$(pkg-config --cflags libsodium) export LDFLAGS=$(pkg-config --libs libsodium) > source ~/.bashrc > echo "/usr/local/lib" > tee -a /etc/ld.so.conf.d/libsodium.conf
如果出现如下问题:
libtool is required, but wasn‘t found on this system
请到如下网址下载libtool并安装
http://ftp.gnu.org/gnu/libtool/
> tar zxvf libtool-2.4.6.tar.gz > cd libtool-2.4.6 > ./configure > make && make install
如果出现如下问题:
autoreconf: Entering directory `.‘ autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --force -I m4 configure.ac:1: error: Autoconf version 2.65 or higher is required configure.ac:1: the top level autom4te: /usr/bin/m4 failed with exit status: 63 aclocal: autom4te failed with exit status: 63 autoreconf: aclocal failed with exit status: 63
到如下网址下载autoconf并安装
http://ftp.gnu.org/gnu/autoconf/
> tar zxvf autoconf-latest.tar.gz > cd autoconf-2.69 > ./configure > make && make install
如果出现如下问题:
configure.ac:682: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. autoreconf: /usr/local/bin/autoconf failed with exit status: 1
建议把如下工具都更新一下
> yum -y install automake autoconf m4 libtool
四、安装php扩展
> tar zmq-1.1.3.tgz > cd zmq-1.1.3 > /data/nmp/php/bin/phpize > ./configure --with-php-config=/data/nmp/php/bin/php-config --with-zmq=/data/zeromq > make && make install
如果出现如下信息:
Installing shared extensions: /data/nmp/php/lib/php/extensions/no-debug-non-zts-20151012/
修改php.ini添加如下
extension = zmq.so
重启php-fpm,查看phpinfo()。
时间: 2024-10-14 10:43:53