diff --git a/dockerfile_templates/docker_includes/php/php.m4 b/dockerfile_templates/docker_includes/php/php.m4
index 8f63844..679a0fa 100644
--- a/dockerfile_templates/docker_includes/php/php.m4
+++ b/dockerfile_templates/docker_includes/php/php.m4
@@ -107,14 +107,17 @@ ifelse(
 PHP_NUM,`74',`        libonig-dev \
         libkrb5-dev \
         libpng-dev \
+        libsodium-dev \
         zlib1g-dev \',
 PHP_NUM,`80',`        libonig-dev \
         libkrb5-dev \
         libpng-dev \
+        libsodium-dev \
         zlib1g-dev \',
 PHP_NUM,`81',`        libonig-dev \
         libkrb5-dev \
         libpng-dev \
+        libsodium-dev \
         zlib1g-dev \',`dnl')
         libmcrypt-dev \
 ifelse(
@@ -225,6 +228,10 @@ PHP_NUM,`71',`            --with-webp-dir \',
 PHP_NUM,`72',`            --with-webp-dir \',
 PHP_NUM,`73',`            --with-webp-dir \',`dnl')
 ifelse(
+PHP_NUM,`74',`            --with-sodium \',
+PHP_NUM,`80',`            --with-sodium \',
+PHP_NUM,`81',`            --with-sodium \',`dnl')
+ifelse(
 PHP_NUM,`74',`            --with-webp \',
 PHP_NUM,`80',`            --with-webp \',
 PHP_NUM,`81',`            --with-webp \',`dnl')
diff --git a/php/7.4-apache/Dockerfile b/php/7.4-apache/Dockerfile
index c7ffdb2..2d1e60c 100644
--- a/php/7.4-apache/Dockerfile
+++ b/php/7.4-apache/Dockerfile
@@ -130,6 +130,7 @@ RUN set -xe \
         libonig-dev \
         libkrb5-dev \
         libpng-dev \
+        libsodium-dev \
         zlib1g-dev \
         libmcrypt-dev \
         libpng-dev \
@@ -178,6 +179,7 @@ RUN set -xe \
             --with-xmlrpc \
             --with-gettext=shared \
             --enable-gd \
+            --with-sodium \
             --with-webp \
             --with-pear \
             --enable-sockets \
diff --git a/php/7.4.x-apache/Dockerfile b/php/7.4.x-apache/Dockerfile
index 6726248..d552043 100644
--- a/php/7.4.x-apache/Dockerfile
+++ b/php/7.4.x-apache/Dockerfile
@@ -129,6 +129,7 @@ RUN set -xe \
         libonig-dev \
         libkrb5-dev \
         libpng-dev \
+        libsodium-dev \
         zlib1g-dev \
         libmcrypt-dev \
         libpng-dev \
@@ -178,6 +179,7 @@ RUN set -xe \
             --with-xmlrpc \
             --with-gettext=shared \
             --enable-gd \
+            --with-sodium \
             --with-webp \
             --with-pear \
             --enable-sockets \
diff --git a/php/8.0-apache/Dockerfile b/php/8.0-apache/Dockerfile
index 9414096..8a73fb2 100644
--- a/php/8.0-apache/Dockerfile
+++ b/php/8.0-apache/Dockerfile
@@ -130,6 +130,7 @@ RUN set -xe \
         libonig-dev \
         libkrb5-dev \
         libpng-dev \
+        libsodium-dev \
         zlib1g-dev \
         libmcrypt-dev \
         libpng-dev \
@@ -178,6 +179,7 @@ RUN set -xe \
             --with-xmlrpc \
             --with-gettext=shared \
             --enable-gd \
+            --with-sodium \
             --with-webp \
             --with-pear \
             --enable-sockets \
diff --git a/php/8.0.x-apache/Dockerfile b/php/8.0.x-apache/Dockerfile
index 837b3a3..44c6772 100644
--- a/php/8.0.x-apache/Dockerfile
+++ b/php/8.0.x-apache/Dockerfile
@@ -129,6 +129,7 @@ RUN set -xe \
         libonig-dev \
         libkrb5-dev \
         libpng-dev \
+        libsodium-dev \
         zlib1g-dev \
         libmcrypt-dev \
         libpng-dev \
@@ -178,6 +179,7 @@ RUN set -xe \
             --with-xmlrpc \
             --with-gettext=shared \
             --enable-gd \
+            --with-sodium \
             --with-webp \
             --with-pear \
             --enable-sockets \
diff --git a/php/8.1-apache/Dockerfile b/php/8.1-apache/Dockerfile
index c183e0b..2d19850 100644
--- a/php/8.1-apache/Dockerfile
+++ b/php/8.1-apache/Dockerfile
@@ -131,6 +131,7 @@ RUN set -xe \
         libonig-dev \
         libkrb5-dev \
         libpng-dev \
+        libsodium-dev \
         zlib1g-dev \
         libmcrypt-dev \
         libpng-dev \
@@ -180,6 +181,7 @@ RUN set -xe \
             --with-xmlrpc \
             --with-gettext=shared \
             --enable-gd \
+            --with-sodium \
             --with-webp \
             --with-avif \
             --with-pear \
