You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 17.04下安装php7.0-mbstring失败求助:PHPUnit安装受阻

Fixing "Unable to locate package php7.0-mbstring" Error on Ubuntu/Debian

Hey there! Let's break down why you're hitting this error and how to fix it.

Why this happens

PHP 7.0 reached its end of life years ago, meaning Ubuntu/Debian's default repositories no longer host packages for it. That's why apt-get can't find php7.0-mbstring—the package isn't in your current sources.

Step 1: Check your actual PHP version first

Before diving into adding new sources, double-check which PHP version you're running. It's possible you might have a newer version installed without realizing it:

php -v

If the output shows a version like 7.4, 8.1, or 8.2, install the matching mbstring package instead. For example, for PHP 8.1:

sudo apt-get install php8.1-mbstring

Step 2: Install PHP 7.0 mbstring (if you really need PHP 7.0)

If you absolutely must stick with PHP 7.0, you'll need to add a third-party repository that still maintains old PHP versions. The most reliable one is maintained by Ondřej Surý:

  1. Install the tools needed to add PPAs:
    sudo apt-get install software-properties-common
    
  2. Add the PHP PPA:
    sudo add-apt-repository ppa:ondrej/php
    
  3. Update your package lists to pull in the new sources:
    sudo apt-get update
    
  4. Now install the mbstring package for PHP 7.0:
    sudo apt-get install php7.0-mbstring
    

Step 3: Verify the installation

After installation, confirm mbstring is enabled by running:

php -m | grep mbstring

You should see mbstring printed in the output if it worked.

A quick recommendation

Since PHP 7.0 is no longer receiving security updates, it's a good idea to upgrade to a supported PHP version (like 7.4, 8.1, or 8.2) whenever possible. This will not only avoid package availability issues but also keep your system secure.

内容的提问来源于stack exchange,提问作者Anitha s

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:06:22