Updating PHP7 FPM On Ubuntu 20.04 For WordPress On Nginx

Download required files

$ apt install -y php7.4 php7.4-cli php7.4-common php7.4-fpm

$ apt install -y php7.4-mysql php7.4-dom php7.4-simplexml php7.4-ssh2 php7.4-xml php7.4-xmlreader php7.4-curl  php7.4-exif  php7.4-ftp php7.4-gd  php7.4-iconv php7.4-imagick php7.4-json  php7.4-mbstring php7.4-posix php7.4-sockets php7.4-tokenizer

$ apt install -y php7.4-mysqli php7.4-pdo  php7.4-sqlite3 php7.4-ctype php7.4-fileinfo php7.4-zip php7.4-exif

Edit PHP.INI

$ nano /etc/php/7.4/fpm/php.ini

Find the string that has to be changed from 1 to 0

cgi.fix_pathinfo=0

Edit Nginx Configuration Files

$ nano /etc/nginx/sites-available/{your config files}

Find the string that has to be changed from eg 7.0 to 7.4

fastcgi_pass unix:/run/php/php7.0-fpm.sock;

Restart PHP And Nginx

Test Nginx configuration and restart PHP7.4 socket

$ nginx -t
$ service nginx restart
$ service php7.4-fpm.service restart