

You should get a response similar to this: PHP 7.4.3 (cli) (built: 23:16:22) ( NTS )Īnd that’s it. To verify if PHP is installed, run the following command: php -v
ONDREJ PHP 8.1 INSTALL
This command will install PHP 7.4, as well as some other dependencies. Next, to install PHP 7.4 on Ubuntu 20.04, just run the following command: apt-get install php
ONDREJ PHP 8.1 UPDATE
Update UbuntuĪgain, before doing anything, you should update your server: apt-get update & apt-get upgrade Install PHP 7.4 We don’t recommend using PHP 7.4, so you should skip to some of the other installation methods below. The instructions are also similar for Ubuntu 22.04, but Ubuntu 22.04 will use whatever the default PHP version it’s using. So the instructions are pretty similar to other variations. PHP 7.4 is included by default in Ubuntu 20.04’s repositories. Some shared hosts have already implemented PHP 8.1 in their shared servers, like Hawk Host and iWebFusion.If one version is installed, you can still upgrade to another. If it gives you a result, it’s installed, if it doesn’t, PHP is not installed. Check if PHP is already installed on your server.You’ll need SSH enabled if you use Ubuntu or an SSH client like MobaXterm if you use Windows.We’ll use the root user in our tutorial so there’s no need to execute each command with ‘sudo’, but if you’re not using the root user, you’ll need to do that. Either use the root user or a user with sudo access. You’ll also need root access to your server.Or you can go with any other cloud server provider where you have root access to the server. You’ll obviously need an Ubuntu server.If you still use PHP 7.4, you definitely need to upgrade ASAP because its security support ends at the end of 2022.

We recommend that you install PHP 8.1 as it’s stable and has lots of improvements and new features. We’ll include instructions for PHP 8.0, PHP 8.1. Starting from the oldest that is currently supported – PHP 7.4, and onto PHP 8.0 and the latest – PHP 8.1.
ONDREJ PHP 8.1 HOW TO
ONDREJ PHP 8.1 PROFESSIONAL
Prepare yourself for a role working as an Information Technology Professional with Linux operating system You will see the PHP info page and confirm PHP-FPM is used with Apache. Now go your browser and point it to your server IP address or domain name followed by the info.php. Here we have configured /var/cd /var/www/html/domain/public sudo nano info.php Sudo service apache2 restart Step 7: Verify PHP-FPM with Apache Now you can enable the new Apache configuration. Hit CTRL + X followed by Y and Enter to save and exit the file. Paste the below configuration in the file.ĬustomLog $/access.log combined

Sudo nano /etc/apache2/sites-available/ nf Sudo service php8.1-fpm restart Step 6: Configure Apache Virtual Hosts Once you have modified your PHP settings you need to restart your PHP-FPM for the changes to take effect. Hit F6 for search inside the editor and update the following values for better performance. Now we configure PHP for Web Applications by changing some values in php.ini file.įor PHP 8.1 with Nginx the php.ini location will be in following directory. If you need HTTP 2 support you can enable it also. Now you can enable PHP-FPM configuration. Sudo a2enmod mpm_event proxy_fcgi setenvif Enable PHP FPM Configuration Sudo a2dissite 000-default Enable Apache Event Moduleĭisable any default preform modules for any existing PHP versions. ADVERTISEMENT sudo apt install apache2 Step 4: Configure Apache with PHP-FPMīy default Apache will use mod_php so now you can configure Apache to use PHP-FPM.ĭisable the default Apache vhost configuration.
