Skip to content

Instantly share code, notes, and snippets.

@yashodhank
Last active December 10, 2024 10:46
Show Gist options
  • Save yashodhank/0c49d3a60dbf413cb210282ee3083d1d to your computer and use it in GitHub Desktop.
Save yashodhank/0c49d3a60dbf413cb210282ee3083d1d to your computer and use it in GitHub Desktop.
ZeroMQ Setup/Installer for Plesk 17 and Plesk Obsidian 18

ZeroMQ Setup/Installer for Plesk 17 and Plesk Obsidian 18

This repository provides installation scripts for setting up ZeroMQ on servers running:

  1. Plesk 17 (Onyx) with PHP 5.6 or 7.x.
  2. Plesk Obsidian 18 on Ubuntu 22.04, compatible with PHP 8.0 and higher.

Features

  • Installs required dependencies such as libzmq, libsodium, and php-zmq.
  • Supports both precompiled Debian packages and manual source compilation.
  • Dynamically configures the PHP-ZMQ extension for all Plesk-managed PHP versions.
  • Fully automated setup scripts for seamless integration.

Installation Notes

  • Plesk 17: Designed for older setups with PHP 5.6 and 7.x support. Utilizes ZeroMQ version 4.2.1.
  • Plesk 18 (Obsidian): Updated for modern systems with PHP 8.0+ support. Installs the latest stable ZeroMQ version (4.3.4) with enhanced security and performance.

Usage

  1. Download the appropriate script for your Plesk version:

    • install-zeromq-plesk17.sh: For Plesk 17
    • install-zeromq-plesk18.sh: For Plesk Obsidian 18
  2. Make the script executable:

    chmod +x install-zeromq-*.sh
  3. Run the script with sudo privileges:

    sudo ./install-zeromq-plesk17.sh
    # or
    sudo ./install-zeromq-plesk18.sh

Verification

After installation, verify the zmq module is loaded for the desired PHP version:

/opt/plesk/php/<PHP_VERSION>/bin/php -m | grep zmq

Replace <PHP_VERSION> with the PHP version you want to test (e.g., 5.6, 8.0, etc.).


Compatibility

  • Operating System: Ubuntu 16.04+ (for Plesk 17), Ubuntu 22.04 (for Plesk Obsidian 18)
  • PHP Versions: PHP 5.6, 7.x, and 8.x managed by Plesk.

This dual-version installer ensures compatibility with both legacy and modern Plesk setups, making it ideal for developers and system administrators working across different environments.

#!/bin/bash
apt-get update
apt-get install libzmq3-dev plesk-php56-dev libtool pkg-config build-essential autoconf automake
cd /tmp
wget https://github.com/zeromq/libzmq/releases/download/v4.2.1/zeromq-4.2.1.tar.gz
tar -xf zeromq-4*
cd zeromq-4*
./autogen.sh
./configure
make install
ldconfig
cd ..
echo '' | /opt/plesk/php/5.6/bin/pecl install zmq-betaecho "Done!
echo "Done!"
#!/bin/bash
# ZeroMQ setup/installer for Plesk Obsidian 18 (Ubuntu 22.04) and PHP 8.0+
# This script assumes Plesk is installed and PHP versions are managed by Plesk.
#
# Save the script as plesk-zmq-install-18.sh
# Make it executable:
# chmod +x plesk-zmq-install-18.sh
#
# Run the script:
# sudo ./iplesk-zmq-install-18.sh
#
# After the script completes, verify the installation:
# /opt/plesk/php/8.0/bin/php -m | grep zmq
echo "Starting ZeroMQ installation..."
# Update the system
apt-get update && apt-get upgrade -y
# Install dependencies
apt-get install -y libzmq3-dev plesk-php-dev libtool pkg-config build-essential autoconf automake libsodium-dev
# Download and compile ZeroMQ
cd /tmp
wget https://github.com/zeromq/libzmq/releases/download/v4.3.4/zeromq-4.3.4.tar.gz
tar -xf zeromq-4.3.4.tar.gz
cd zeromq-4.3.4 || { echo "Failed to enter ZeroMQ source directory!"; exit 1; }
# Compile and install
./autogen.sh
./configure
make -j$(nproc)
make install
ldconfig
# Install PHP-ZMQ extension for PHP 8.0+
for PHP_VERSION in $(plesk php -v | grep -oP '^[78]\.\d+'); do
echo "Installing PHP-ZMQ for PHP $PHP_VERSION..."
apt-get install -y "plesk-php${PHP_VERSION//.}-dev"
/opt/plesk/php/$PHP_VERSION/bin/pecl install zmq || echo "Failed to install zmq for PHP $PHP_VERSION"
echo "extension=zmq.so" > /opt/plesk/php/$PHP_VERSION/etc/php.d/zmq.ini
done
echo "ZeroMQ installation completed!"
@yashodhank
Copy link
Author

yashodhank commented Dec 10, 2024

@BlackAriesStudios try again, updated script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment