Install PHP for Nginx Server in Ubuntu 20.04 Operating System Cloud Hosting

Unlike Apache Server, Nginx server has no native PHP installed. So we are required to install PHP-FPM. The full form of FPM is FastCGI Process Manager. Following article, will help you to install php and php mysql as well.

PHP Installation in Nginx Server

Following command will update all the required updates and also going to install php and phpmysql.

test@tester:~$ sudo apt update && sudo apt install php-fpm php-mysql

After successful execution of above mentioned command, use following command to check whether php is successfully installed or not.

test@tester:~$ PHP –version

It will print something like below.

PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

So the output tells php 7.4 is installed. If you do not see the php version, then chances are php failed to install.


I hope, the above step by step guide to install PHP in Nginx Server at Ubuntu 20.04 Operating system is helpful to you.