Installing PHP 8.4

Dear HestiaCP community,
With the upcoming release of PHP 8.4 on November 21, 2024, I’m seeking guidance on two specific matters:
What is the most reliable method to install PHP 8.4 on HestiaCP via command line?
How can I ensure that my custom configurations in the php.ini file are not overwritten during HestiaCP updates?
I would greatly appreciate detailed instructions or references to appropriate documentation for these processes.

1 Like

At present, there should be no increase in the release version. It will be added in version 1.90. If you need to experience it first, you can use it servbay experience

My request was not about asking for implementation in Hestia, as I’m aware that we would have to wait at least 6 months for that. Instead, I was inquiring about installing it in a customized manner.

Edit /usr/local/hestia/install/upgrade/upgrade.conf and add "8.4" to multiphp_v:

multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3" "8.4")

Edit /usr/local/hestia/web/edit/server/index.php and add "php-8.4", to $v_php_versions:

$v_php_versions = [
        "php-5.6",
        "php-7.0",
        "php-7.1",
        "php-7.2",
        "php-7.3",
        "php-7.4",
        "php-8.0",
        "php-8.1",
        "php-8.2",
        "php-8.3",
        "php-8.4",
];

Edit /usr/local/hestia/bin/v-run-cli-cmd and add 'php8.4' to basecmd:

if [ "$basecmd" != 'ps' -a \
        "$basecmd" != 'ls' -a \
        "$basecmd" != 'tar' -a \
        "$basecmd" != 'zip' -a \
        "$basecmd" != 'unzip' -a \
        "$basecmd" != 'gzip' -a \
        "$basecmd" != 'gunzip' -a \
        "$basecmd" != 'mkdir' -a \
        "$basecmd" != 'find' -a \
        "$basecmd" != 'id' -a \
        "$basecmd" != 'grep' -a \
        "$basecmd" != 'egrep' -a \
        "$basecmd" != 'sed' -a \
        "$basecmd" != 'cat' -a \
        "$basecmd" != 'php5.6' -a \
        "$basecmd" != 'php7.0' -a \
        "$basecmd" != 'php7.1' -a \
        "$basecmd" != 'php7.2' -a \
        "$basecmd" != 'php7.3' -a \
        "$basecmd" != 'php7.4' -a \
        "$basecmd" != 'php8.0' -a \
        "$basecmd" != 'php8.1' -a \
        "$basecmd" != 'php8.2' -a \
        "$basecmd" != 'php8.3' -a \
        "$basecmd" != 'php8.4' -a \
        "$basecmd" != 'php' -a \
        "$basecmd" != "wp" -a \
        "$basecmd" != 'composer' ]; then
        check_result "$E_FORBIDEN" "Error: Cli command not enabled"
fi

Edit: I forgot to modify /usr/local/hestia/bin/v-restart-service to add "php8.4-fpm":

        elif [ -z "$restart" -o "$restart" = "no" ] && [ \
                "$service" = "nginx" -o \
                "$service" = "apache2" -o \
                "$service" = "exim4" -o \
                "$service" = "dovecot" -o \
                "$service" = "bind9" -o \
                "$service" = "named" -o \
                "$service" = "vsftpd" -o \
                "$service" = "php5.6-fpm" -o \
                "$service" = "php7.0-fpm" -o \
                "$service" = "php7.1-fpm" -o \
                "$service" = "php7.2-fpm" -o \
                "$service" = "php7.3-fpm" -o \
                "$service" = "php7.4-fpm" -o \
                "$service" = "php8.0-fpm" -o \
                "$service" = "php8.1-fpm" -o \
                "$service" = "php8.2-fpm" -o \
                "$service" = "php8.3-fpm" -o \
                "$service" = "php8.4-fpm" -o \
                "$service" = "proftpd" -o \
                "$service" = "ssh" -o \
                "$service" = "fail2ban" ]; then
                systemctl reload-or-restart "$service" >> $log 2>&1
        else

As php 8.4 is now available on Sury’s repository, you can install it using Hestia’s Web UI or run this script from command line:

v-add-web-php 8.4

UPDATE: seems there is a problem loading imagick library so you should wait before installing php 8.4.

UPDATE 2: imagick module has been fixed so no more library errors.

Hestia usually doen’t modify php.ini files, only for security reasons. If something is overwritting the files is your OS (dpkg), always use Keep current conf when updating packages.

3 Likes

Great, thank you! Sahsanu, as always, you are a master of your craft

1 Like

Please make wait until PHP8.4 has been released deb.sury.org ussally it takes a few days…

1 Like
2 Likes

8.4? What happened to 1.9?

Also I can’t choose php8.3 in the WordPress quick installation. However, in the templates (php) I can choose php8.3.

8.4 is the new PHP version that should be released today 21st November and 1.9 is the next major release for Hestia.

Execute this command as root and you should be able to use php 8.3 on WordPress Quick Install.

sed -i 's/"8.2"/"8.2", "8.3"/' /usr/local/hestia/web/src/app/WebApp/Installers/WordPress/WordPressSetup.php
1 Like

Thanks. WordPress has some notes about the compatibility with php8.4 WordPress 6.7 Server Compatibility.

Yeah. I’d prefer stability over ‘rushing to get 8.4 out the door’.

My server got owned today. THANKS. I’m in a BULLSHIT mood.

How do I UNDO this?
I tried adding 8.3 months ago.

It’s NOT showing up anymore. So I’d like to UNDO this script.
And then I’ll wait for 1.9 to bring 8.3 AND 8.4

I think that EVERYTHING every single script we ever provide should have an UNDO script also. Sorry. I just have a lot to deal with tonight.

THANK YOU. i’ll review this soon.

2 Likes

For those early adopters, I tested it and it will fail when trying to use v-add-web-php 8.4

UPDATE: packages php8.4-imap and php8.4-pspell are now available on sury’s repository.

UPDATE 2: package php8.4-imagick is now available on sury’s repository, so there is no need to apply any workaround, v-add-web-php 8.4 will work as expected if you followed the previous steps to modify Hestia.

Summary
❯ v-add-web-php 8.4
Installing PHP-8.4, please wait...
\
ERROR: Installation failed, please run the following command manually for debugging:
apt-get install php8.4-common php8.4-mbstring php8.4-bcmath php8.4-cli php8.4-curl
     php8.4-fpm php8.4-gd php8.4-intl php8.4-mysql
     php8.4-soap php8.4-xml php8.4-zip  php8.4-bz2
     php8.4-pspell php8.4-imagick  php8.4-imap php8.4-ldap
cp: cannot create regular file '/etc/php/8.4/fpm/pool.d/': No such file or directory
sed: can't read /etc/php/8.4/fpm/pool.d/dummy.conf: No such file or directory
cp: cannot create regular file '/etc/php/8.4/fpm/': Not a directory
sed: can't read /etc/php/8.4/fpm/php-fpm.conf: No such file or directory
sed: can't read /etc/php/8.4/fpm/php.ini: No such file or directory
sed: can't read /etc/php/8.4/fpm/php.ini: No such file or directory
sed: can't read /etc/php/8.4/fpm/php.ini: No such file or directory
sed: can't read /etc/php/8.4/fpm/php.ini: No such file or directory
sed: can't read /etc/php/8.4/fpm/php.ini: No such file or directory
sed: can't read /etc/php/8.4/fpm/php.ini: No such file or directory
sed: can't read /etc/php/8.4/fpm/php.ini: No such file or directory
sed: can't read /etc/php/8.4/fpm/php.ini: No such file or directory

It fails because three one package is not available yet (php8.4-pspell, php8.4-imap and php8.4-imagick).

To workaround this issue, edit file /usr/local/hestia/bin/v-add-web-php and add this:

if [[ ${version} == "8.4" ]]; then
        mph=$(echo "$mph" | sed -e "s/php$version-imagick//")
fi

In context:

# Check if version is 8.0 or higher and drop php json.
if [[ ${version:0:1} == "8" ]]; then
        mph=$(echo "$mph" | sed -e "s/php$version-json//")
fi

if ! echo "$DB_SYSTEM" | grep -w 'mysql' > /dev/null; then
        mph=$(echo "$mph" | sed -e "s/php$version-mysql//")
fi

if ! echo "$DB_SYSTEM" | grep -w 'pgsql' > /dev/null; then
        mph=$(echo "$mph" | sed -e "s/php$version-pgsql//")
fi

if [[ ${version} == "8.4" ]]; then
        mph=$(echo "$mph" | sed -e "s/php$version-imagick//")
fi


# Install php packages
if [ -f '/etc/redhat-release' ]; then
        dnf makecache -q
        dnf install -q -y $mph > /dev/null 2>&1 &
else
        apt-get -qq update
        apt-get -y -qq -o Dpkg::Options::="--force-confold" install $mph > /dev/null 2>&1 &
fi

Also, edit file /usr/local/hestia/bin/v-delete-web-php and add this:

if [[ ${version} == "8.4" ]]; then
        mph=$(echo "$mph" | sed -e "s/php$version-imagick//")
fi

In context:

# Check is version is 7.1 or below to add mcrypt
if [[ $(echo "$version 7.2" | awk '{print ($1 < $2)}') == 1 ]]; then
        mph="$mph php$version-mcrypt"
fi

if [[ ${version} == "8.4" ]]; then
        mph=$(echo "$mph" | sed -e "s/php$version-imagick//")
fi

# Purge php packages
if [ -f '/etc/redhat-release' ]; then
        dnf remove -y $mph > /dev/null 2>&1 &
else
        apt-get -y purge $mph > /dev/null 2>&1 &
fi
BACK_PID=$!

Most likely the will come in the next few days… imagick for sure …

1 Like

It is on the supported list

Packages php8.4-imap and php8.4-pspell are now available on Sury’s repository.

Package php8.4-imagick is now available on Sury’s repository, so there is no need to apply any workaround, v-add-web-php 8.4 will work as expected if you followed the previous steps to modify Hestia.

UPDATE: seems there is a problem loading imagick library so you should wait before installing php 8.4.

NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib/php/20240924/imagick.so (/usr/lib/php/20240924/imagick.so: undefined symbol: php_strtolower), /usr/lib/php/20240924/imagick.so.so (/usr/lib/php/20240924/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

UPDATE 2: imagick module has been fixed so no more library errors.

Has PHP 8.4 been demonstrated to be MUCH FASTER than 8.3?

I just don’t know why people go WILLY-NILLY to apply the latest and greatest ON A PRODUCTION MACHINE.

I mean, for DEV? Sure.
I do have a new DEV/TEST hestia VPS. I love it. It’s running great.

8.4 has some new “useful” features

It won’t be 2 / 3 times faster has not a lot has been changed …