DEV Community

Emmanuel Nkrumah-Sarpong
Emmanuel Nkrumah-Sarpong

Posted on

How to install php-sqlite3 for php 8.1 on Ubuntu 21.10

Installing the sqlite driver for php 8.1 on Ubuntu 21.10 should be as simple as running:

sudo apt install php-sqlite3
Enter fullscreen mode Exit fullscreen mode

However if you got the error:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php8.1-sqlite3 : Depends: php8.1-common (= 8.1.2-1ubuntu2.10) but 8.1.5-1+ubuntu21.10.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
Enter fullscreen mode Exit fullscreen mode

Then you are in good company. This is how I solved. it.

Solution

NB: You should already have php 8.1 installed. Running php --version should give a result of php 8.1 and above.

1. Update your System Dependencies

sudo apt update
sudo apt upgrade
Enter fullscreen mode Exit fullscreen mode

2. Add PHP PPA

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Enter fullscreen mode Exit fullscreen mode

3. Install php-sqlite3

sudo apt install php8.1-sqlite3
Enter fullscreen mode Exit fullscreen mode

This should work now.

Acknowledgement

This article is just a copy of https://medium.com/@laraveltuts/how-to-install-and-run-php-8-x-on-ubuntu-20-04-8f18e7565c41 shamelessly specialized for fixing the unmet dependencies problem.

Top comments (0)