Magento2 php8.1 extension install
Magento2 php8.1 extension install on magento 2.4.5.p1 open source version.
Here using Ubuntu version 20.04 and magento version 2.4.5.p1 and Web server apache
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.1 php8.1-xml php8.1-intl php8.1-bcmath php8.1-common php8.1-curl php8.1-xml php8.1-gd php8.1-intl php8.1-mbstring php8.1-soap php8.1-xsl php8.1-zi
If you have already has another PHP version then do below process. At my system php7.4
sudo update-alternatives --set php /usr/bin/php8.1
sudo a2dismod php7.4
sudo a2enmod php8.1
systemctl restart apache2