sudo apt-get install software-properties-common -y sudo add-apt-repository ppa:ondrej/php [ Ondrej for insatlling multiple php versions] sudo apt-get update -y sudo apt-get install php7.2 php7.2-fpm php7.2-mysql libapache2-mod-php7.2 libapache2-mod -fcgid -y sudo apt-get install php8.1 php8.1-fpm php8.1-mysql libapache2-mod-php8.1 -y libapache2-mod -fcgid only once if its already installed no need a2enconf php8.2-fpm to make default add in etc/apache2/sites-avialble ---- .conf <FilesMatch \.php$> # For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server SetHandler "proxy:unix:/run/php/ php8.1 -fpm.sock|fcgi://localhost" </FilesMatch> call to undefined function mb_strcut() laravel install php8.2-mbstring