Installing and Configuring PHP Versions in HestiaCP ⚙️💻
This guide covers the installation of PHP 8.2, 8.3, and 8.4 in HestiaCP, copying template files for configuration, and fixing the Nginx GPG key issue 🔑.
Fix Nginx GPG Key Issue (Ubuntu 22.04+) 🔐
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://nginx.org/packages/mainline/ubuntu $(lsb_release -cs) nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
Install PHP 8.2 and Required Extensions 🐘
apt install php8.2-fpm php8.2-opcache php8.2-mysql php8.2-cli php8.2-curl php8.2-cgi php8.2-xsl php8.2-readline php8.2-zip php8.2-imap php8.2-imagick php8.2-mbstring php8.2-xml php8.2-bz2 php8.2-ftp php8.2-intl php8.2-common php8.2-gd php8.2-xmlrpc php8.2-pgsql php8.2-tidy php8.2-dev php8.2-sybase php8.2-ssh2 php8.2-odbc php8.2-memcache php8.2-pspell php8.2-soap php8.2-sqlite3 php8.2-memcached php8.2-xmlreader php8.2-phpdbg php8.2-bcmath php8.2-snmp php8.2-ldap php8.2-dba php8.2-mcrypt -y
Copy PHP-FPM Template for PHP 8.2 📄
cp -prf /usr/local/hestia/data/templates/web/php-fpm/default.tpl /usr/local/hestia/data/templates/web/php-fpm/new-PHP-8_2.tpl
Install PHP 8.3 and Required Extensions 🐘
apt install -y php8.3-fpm php8.3 php8.3-cli php8.3-common php8.3-opcache php8.3-mysql \ php8.3-curl php8.3-gd php8.3-mbstring php8.3-xml php8.3-bcmath php8.3-zip \ php8.3-intl php8.3-readline php8.3-soap php8.3-sqlite3 php8.3-pgsql php8.3-tidy \ php8.3-dev php8.3-imagick php8.3-pspell php8.3-snmp php8.3-ldap php8.3-dba \ php8.3-imap php8.3-memcached php8.3-xmlrpc php8.3-ssh2 php8.3-odbc php8.3-phpdbg
Copy PHP-FPM Template for PHP 8.3 📄
cp -prf /usr/local/hestia/data/templates/web/php-fpm/default.tpl /usr/local/hestia/data/templates/web/php-fpm/new-PHP-8_3.tpl
Install PHP 8.4 and Required Extensions 🐘
apt install -y php8.4-fpm php8.4 php8.4-cli php8.4-common php8.4-opcache php8.4-mysql \ php8.4-curl php8.4-gd php8.4-mbstring php8.4-xml php8.4-bcmath php8.4-zip \ php8.4-intl php8.4-readline php8.4-soap php8.4-sqlite3 php8.4-pgsql php8.4-tidy \ php8.4-dev php8.4-imagick php8.4-pspell php8.4-snmp php8.4-ldap php8.4-dba \ php8.4-imap php8.4-memcached php8.4-xmlrpc php8.4-ssh2 php8.4-odbc php8.4-phpdbg
Copy PHP-FPM Template for PHP 8.4 📄
cp -prf /usr/local/hestia/data/templates/web/php-fpm/default.tpl /usr/local/hestia/data/templates/web/php-fpm/new-PHP-8_4.tpl
Restart HestiaCP 🔄
systemctl restart hestia
Verify PHP Versions ✅
php8.2 -v php8.3 -v php8.4 -v
Check PHP-FPM services:
systemctl status php8.2-fpm systemctl status php8.3-fpm systemctl status php8.4-fpm
Conclusion 🎯
PHP 8.2, 8.3, and 8.4 are installed and configured in HestiaCP. Select the desired PHP version for your websites from Hestia’s web interface.