How to Install PHP on Ubuntu 20.04
1- login via root
Installing PHP 7.4 with Apache
If you’re using Apache as your web server, run the following commands to install PHP and Apache PHP module:
2-sudo apt update
3-sudo apt install php libapache2-mod-php
Once the packages are installed, restart Apache for the PHP module to get loaded:
4- sudo systemctl restart apache2
Define Array of Insalled PHP Versions.
5-phpVersion="7.4";
Install PHP and PHP-FPM.
6- apt install php${phpVersion} php${phpVersion}-{bcmath,bz2,cli,common,curl,fpm,gd,gmp,imagick,intl,json,mbstring,mysql,readline,xml,zip}
7-Testing PHP Processing
To test whether the webserver is configured properly for PHP processing, create a new file named info.php inside the /var/www/html directory with the following code:
/var/www/html/info.php
<?php
phpinfo();
?>
Save the file, open your browser, and visit: http://your_server_ip/info.php.
Thanks
webanchor Support Team
https://www.webanchor.net