$ sudo apt update Step 4: Install PHP 8.1 on Ubuntu 20.04 / 22.04Īt this point, the only thing left to do is to install PHP 8.1. Next, update your package lists for the system to sync with the newly added repository. To verify that the repository was added, run the command: $ sudo grep -rhE ^deb /etc/apt/sources.list* | grep -i ondrej When you get to this section, simply press ENTER to proceed with the installation. To achieve this, we will run the command: $ sudo add-apt-repository ppa:ondrej/php In order to install it, we need to add the Ondrej PHP repository which provides the latest versions of PHP. PHP 8.1 is not available on the official Ubuntu repositories. Step 3: Install Ondrej PHP repository on Ubuntu 20.04 Press ‘Y’ when prompted to continue with the installation. $ sudo apt install ca-certificates apt-transport-https software-properties-common Install the following requirements for the installation to proceed smoothly. Step 2: Install prerequisitesīefore we proceed with the installation of PHP 8.1, we need to install a few prerequisites. Our mission, however, is to install PHP 8.1, and therefore we will ignore this suggestion. Here, the terminal output points out how we can install PHP 7.4 You will then get a suggestion of how you can install PHP. If PHP is not installed, you should get a warning that ‘php’ not found. Once the package lists have been updated, you can verify if you have any version of PHP installed. Right off the bat, log in to your instance of Ubuntu and update the package index as follows: $ sudo apt update ![]() ![]() Step 1: Update Ubuntu 20.04 / Ubuntu 22.04 In this guide, we will demonstrate how to install PHP 8.1 on Ubuntu 20.04 / 22.04. Check out some of the new features provided by the latest version. It comes with its own unique set of features and deprecations. Now we can host our website on it.PHP 8.1 was released on November 25, 2021, and is a minor release of the PHP 8 series. We have successfully configured our Nginx server with PHP-FPM. Save the configuration file and restart Nginx server to apply the changes: sudo systemctl restart rvice Uncomment or add the following lines for PHP-FPM to run on your server:ĭon't forget to add the index.php to the indexes list: Now that you have PHP-FPM installed, you will need to update the Nginx configuration file ( with nano or any other editor): sudo nano /etc/nginx/sites-available/default Extensions available by default are the listed below: You just need to replace extension with the one you want to install, e.g., mysql, curl, gd, xml, etc. The command to install PHP 8.1 extensions on Ubuntu is: sudo apt install php8.1. To list all loaded extensions run the following command: php -modules The output will show the installed version of PHP: The above command will download and install all of the necessary dependencies.Ĭheck the successful PHP installation with the command: php -v With the PPA enabled, you can install PHP 8.1: sudo apt-get update & sudo apt-get install php8.1-fpm When prompted, press ENTER to proceed with adding the repository. Next, add the Ondrej PPA: sudo add-apt-repository ppa:ondrej/php Let’s update Ubuntu system packages and install some dependencies as shown: sudo apt-get update & sudo apt-get install ca-certificates apt-transport-https software-properties-common This repository contains multiple PHP versions and PHP extensions. To install the latest version of PHP, we are going to use the Ondrej PPA repositories. Installing PHP8.1 FPMĪt the time of writing this tutorial PHP 7.4 is the default PHP version in Ubuntu 20.04 repositories. The example shows how to uninstall PHP7 and related packages, adjust it the version you have installed. If you already have installed a previous version of PHP we recommend to uninstall it executing the following command: sudo apt-get purge php7.* If you do not already have it, take a look to our Nginx installation and configuration tutorial. Prerequisitesīefore you begin, you will need a working Nginx setup. ![]() ![]() It is the preferred method of processing PHP pages with Nginx and is faster than traditional CGI based methods. FPM is an alternative PHP FastCGI implementation with some additional features (mostly) useful for heavy-loaded sites. One of these plugins is FPM (FastCGI Process Manager). PHP code is usually processed on a web server by a PHP interpreter implemented as a module, a daemon or as a Common Gateway Interface (CGI) executable.īy default Nginx is not capable of processing dynamic web pages with PHP so it requires the use of specific additional plugins for this purpose. PHP is a general-purpose scripting language geared towards web development.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |