Compile php8.1 on Debian11

Preparations :

apt install build-essential libapparmor-dev libxml++2.6-dev libxml2-dev libkrb5-dev krb5-multidev libcurl3-openssl-dev libcurl4-openssl-dev libgnutls-openssl-dev libgnutls-openssl-dev librust-openssl-0-dev librust-openssl-0.10-dev libbz2-dev libpng-dev librust-png-0-dev librust-png-0.15-dev librust-png-0.15.0-dev libwebp-dev libjpeg-dev libjpeg62-turbo-dev libmjpegtools-dev libturbojpeg-dev libturbojpeg0-dev libjpgalleg4-dev libfreetype-dev libfreetype6-dev libldap-dev libsasl2-dev libpq-dev libpspell-dev libargon2-dev libargon2-0-dev libtidy-dev libxslt1-dev libxslt-dev libzip-dev libzip-ocaml-dev libzip-ocaml-dev-l8p50 libsqlite3-dev libonig-dev

Download php sources:

cd /usr/local/src/
wget https://www.php.net/distributions/php-8.1.13.tar.gz
tar xzvf php-8.1.13.tar.gz
cd php-8.1.13/

Configure:

./configure \
--prefix=/opt/php-8.1 \
--with-config-file-scan-dir=/opt/php-8.1/lib/mods-enabled \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype \
--enable-mbstring \
--enable-soap \
--enable-calendar \
--with-curl \
--enable-gd \
--with-pgsql \
--disable-rpath \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-pcntl \
--enable-mbregex \
--enable-exif \
--enable-bcmath \
--with-mhash \
--with-zip \
--with-pdo-mysql \
--with-mysqli \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-jpeg \
--with-webp \
--with-openssl \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--enable-ftp \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--with-xsl \
--enable-opcache \
--with-gmp \
--with-tidy \
--enable-intl \
--enable-fpm \
--with-pspell \
--with-password-argon2 \
--with-pear \
--with-ldap \
--with-ldap-sasl \
--with-fpm-apparmor

Build & Install:

make && make install 

You can found your php under:

/opt/php-8.1/



Image/Logo:
From Colin Viebrock – http://php.net/logos, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=9632398