# Php8.1 update

**URL:** <https://discussions.eramba.org/t/php8-1-update/2194>\
**Category:** Forum - Installation\
**Created:** [June 30, 2022, 2:03pm UTC](https://discussions.eramba.org/t/php8-1-update/2194 "2022-06-30T14:03:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam](https://discussions.eramba.org/letter_avatar_proxy/v4/letter/s/5f9b8f/32.png) [@sam](https://discussions.eramba.org/u/sam)\
**Post date:** [June 30, 2022, 2:03pm UTC](https://discussions.eramba.org/t/php8-1-update/2194/1 "2022-06-30T14:03:27Z")

</div>

Some of our customers ask for a guide on updating PHP. We are not supporting the system beneath the eramba, but I believe it may help some of you. It may of course differ on different servers, this one will work for sure for those using our pre-configured VM.  
The process is very straightforward, make sure you are running it as a root user.

### Installing PHP 8.1 on Ubuntu 20.04

#### 1. Run system updates

```auto
$ apt update && apt upgrade -y

```

#### 2. Add Ondrey sury PPA repository

```auto
$ add-apt-repository ppa:ondrej/php

```

#### 3. Update repositories again

```auto
$ apt update

```

#### 4. Install PHP 8.1 and all modules needed for eramba

```auto
$ apt install php8.1 php8.1-mysql php8.1-intl php8.1-curl php8.1-mbstring php8.1-xml php8.1-zip php8.1-ldap php8.1-gd php8.1-bz2 php8.1-sqlite3 php8.1-redis

```

\*For RHEL and CentOS:

```auto
$ dnf install php8.1 php8.1-mysql php8.1-intl php8.1-curl php8.1-mbstring php8.1-xml php8.1-zip php8.1-ldap php8.1-gd php8.1-bz2 php8.1-sqlite3 php8.1-redis php8.1-process

```

#### 5. Copy php.ini files from the previous PHP version

```auto
$ cp /etc/php/7.x/apache2/php.ini /etc/php/8.1/apache2/.

```

```auto
$ cp /etc/php/7.x/cli/php.ini /etc/php/8.1/cli/.

```

#### 6. Disable php7.4

```auto
$ a2dismod php7.4

```

#### 7. Enable php8.1

```auto
$ a2enmod php8.1

```

#### 8. Restart apache

```auto
$ systemctl restart apache2

```

#### 9. Make sure that cli and apache using same PHP version

for cli:

```auto
$ php -v

```

for apache:

 ![image](https://discussions.eramba.org/uploads/default/original/2X/2/2d8631d13b08a323e1faf198f2de3a18645885a7.png)
