@Tom-Elliott manage to get it working. I updated from php 7.2 to php 8.3 with the remi repo. After that installed the ssh2 module with “dnf install php-ssh2”
dnf module reset php
dnf module switch-to php:remi-8.3
dnf module install php:remi-8.3
dnf update
dnf install php-ssh2