How to Install PHP 8.1 on Ubuntu Server?

405 Views Asked by At

I'm trying to install PHP 8.1 on my Ubuntu Server, but I'm encountering difficulties. I followed the standard procedure, adding the Ondřej Surý PPA, but I can't seem to find the PHP 8.1 package.

I've updated my system and executed the following commands:

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.1

I expected the installation to proceed smoothly. Can someone guide me on how to install PHP 8.1 on Ubuntu Server 18.04 or suggest an alternative method?

1

There are 1 best solutions below

0
CoFfEe0LaVa On

First you will need to usesudo -i if you wont to not typesudo and your password every time and to do it you need.

 apt update
 apt upgrade
 apt install php
 apt update
 apt upgrade

That will install automatically the newest version of php or "php8.1". And if wona know the path of php.ini for configurating php in apache2 service is in /etc/php/8.1/apache2/