Linux SysAdmin & DevOps

ZeroMQ PHP-7.3 extension – how to easily install it on cPanel/WHM

ZeroMQ - a software library that lets you quickly design and implement a fast message-based application!

So I had this project where I was supposed to install Xibo CMS. Among other requirements, XIBO CMSneeds php-zmq extension. The server was running cPanel/WHM.

For PHP-7.1 and PHP-7.2 installing the php extension is pretty straight forward:

/usr/bin/ea-php71-pecl install channel://pecl.php.net/zmq-1.1.3
/usr/bin/ea-php72-pecl install channel://pecl.php.net/zmq-1.1.3

Well, for PHP-7.3 it doesn’t work like that since the any of the above commands, using php-7.3 will result into a compilation error and the exntesion won’t be installed.

After a little bit of digging and reading, I came up with this:

1) Ensure you have git installed and some library development files:

yum -y install git zeromq-devel

2) Clone php-zmq repository:

git clone https://github.com/zeromq/php-zmq.git

3) Configure php-zmq

cd php-zmq
/opt/cpanel/ea-php73/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
make
make install

4) Enable ZeroMQ extension for php-7.3:

cd /opt/cpanel/ea-php73/root/etc/php.d/
echo "extension="zmq.so" > zzzzzzz-pecl.ini
systemctl restart ea-php73-php-fpm.service

And voila, php-zmq for PHP-7.3 is fully functional!