DEV Community

Emmanuel Nkrumah-Sarpong
Emmanuel Nkrumah-Sarpong

Posted on

14

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.

Neon image

Build better on Postgres with AI-Assisted Development Practices

Compare top AI coding tools like Cursor and Windsurf with Neon's database integration. Generate synthetic data and manage databases with natural language.

Read more →

Top comments (0)

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup 🚀

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay