skip to Main Content

I’ve got a webserver running a few different php versions. Whereas php 8.2 has mbstring installed, I need to install mbstring for php 7.4 as well. However, when trying to install it using sudo apt-get install php7.4-mbstring I receive the following error:

E: Unable to locate package php7.4-mbstring
E: Couldn't find any package by glob 'php7.4-mbstring'
E: Couldn't find any package by regex 'php7.4-mbstring'

I have tried running sudo apt-get update and sudo apt-get upgrade but the installation still fails.
I’ve also tried adding the "universe" repository as described in this thread: Cannot install php-mbstring on ubuntu 18.04
In addition I’ve also added the ondrej repository sudo add-apt-repository ppa:ondrej/php but again with the result being the same.

None of the proposed answers in the following threads have lead to a solution so far:

The server is running Ubuntu 18.04

2

Answers


  1. It seems like you’re facing difficulties installing the mbstring extension for PHP 7.4 on your Ubuntu 18.04 server. While you’ve taken some appropriate steps like updating and adding repositories, the issue persists. To address this, you might consider the following:

    Ensure you’ve correctly added the ondrej repository for PHP:

    sql
    Copy code
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    Double-check the package name. It might be php7.4-mbstring or php7.4-mbstring depending on the package naming convention.

    Confirm that you have the correct repository enabled. The package might be in the main repository, so you don’t necessarily need to add the "universe" repository.

    Try clearing the package cache and then attempt the installation again:

    sql
    Copy code
    sudo apt-get clean
    sudo apt-get autoclean
    sudo apt-get update
    sudo apt-get install php7.4-mbstring

    Login or Signup to reply.
  2. Ubuntu 18.04 LTS as well as PHP 7.4 have reached EOL (end of life). That means they are no longer supported and you should upgrade.

    See the Ubuntu release cycle and PHP Supported Versions. Ubuntu 18.04 reached EOL on May 31, 2023 and PHP 7.4 already on Nov 28, 2022!

    The PPA supplied by the wonderful Ondřej Surý only supplies packages for active Ubuntu versions. On his website he states "Don’t ask for end-of-life PHP versions or Ubuntu release, they won’t be provided."

    I recently however had success in updating PHP 7.4 on a Ubuntu 20.04 LTS machine, which is still supported. There is no guarantee how long this will be supported, though.

    You need to upgrade to a supported version for your app to continue functioning and to be safe from security issues.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search