Page 1 of 1

How to install php-snappy module on Debian

Posted: Wed Nov 12, 2025 11:49 am
by myVesta

Code: Select all

php -v | grep 'built'
# Remember the current default PHP version, let's say it is PHP 8.4

# Switch to the PHP version that you need for the 'snappy', in this example, we will install 'snappy' for PHP 8.1:
update-alternatives --set php /usr/bin/php8.1

# Install required libs:
apt update
apt -y install php8.1-dev php-pear build-essential autoconf automake libtool pkg-config cpp g++ gcc libc6-dev libsnappy-dev zlib1g-dev

# Compile snappy:
git clone --recursive --depth=1 https://github.com/kjdev/php-ext-snappy.git
cd php-ext-snappy
phpize
./configure
make
make install

# Insert and enable compiled PHP module:
printf "; priority=20\nextension=snappy.so\n" > /etc/php/8.1/mods-available/snappy.ini
phpenmod -v 8.1 snappy
systemctl restart php8.1-fpm

# Bring back the previously default PHP version, we said it was 8.4 in this example:
update-alternatives --set php /usr/bin/php8.4