Ubuntu 18.04:laravel/framework v6.9.0需要ext-mbstring *->您的系统缺少所请求的PHP扩展名mbstring

问题描述:

在有人将其删除以进行复制之前.我检查了其他页面,但它们没有帮助.

Before someone takes this down for duplication. I've checked the other pages and they weren't helpful.

我正在尝试在PHP 7.2上为Laravel 6安装一个软件包.我也尝试过PHP 7.4.

I'm trying to install a package for Laravel 6 on PHP 7.2. I've also tried PHP 7.4.

不幸的是,我收到以下错误:

Unfortunately, I get the following error:

laravel/framework v6.9.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.

我已经安装了mbstring,并且在7.2和7.4的php.ini文件中都未对其添加注释:

I've installed mbstring and uncommented it in both the php.ini files for 7.2 and 7.4:

extension=mbstring

我知道的唯一解决方案是重新启动apache2服务器.但是我仍然得到错误.

The only solution to this I would know is restarting the apache2 server. But I still get the error.

我的composer.json需要PHP 7.2.

My composer.json is requiring PHP 7.2.

我也遇到这些错误:

- Installation request for laravel/framework (locked at v6.9.0, required as ^6.2) -> satisfiable by laravel/framework[v6.9.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.4/cli/php.ini
    - /etc/php/7.4/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.4/cli/conf.d/10-opcache.ini
    - /etc/php/7.4/cli/conf.d/10-pdo.ini
    - /etc/php/7.4/cli/conf.d/15-xml.ini
    - /etc/php/7.4/cli/conf.d/20-calendar.ini
    - /etc/php/7.4/cli/conf.d/20-ctype.ini
    - /etc/php/7.4/cli/conf.d/20-dom.ini
    - /etc/php/7.4/cli/conf.d/20-exif.ini
    - /etc/php/7.4/cli/conf.d/20-ffi.ini
    - /etc/php/7.4/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.4/cli/conf.d/20-ftp.ini
    - /etc/php/7.4/cli/conf.d/20-gd.ini
    - /etc/php/7.4/cli/conf.d/20-gettext.ini
    - /etc/php/7.4/cli/conf.d/20-iconv.ini
    - /etc/php/7.4/cli/conf.d/20-json.ini
    - /etc/php/7.4/cli/conf.d/20-mysqli.ini
    - /etc/php/7.4/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.4/cli/conf.d/20-phar.ini
    - /etc/php/7.4/cli/conf.d/20-posix.ini
    - /etc/php/7.4/cli/conf.d/20-readline.ini
    - /etc/php/7.4/cli/conf.d/20-shmop.ini
    - /etc/php/7.4/cli/conf.d/20-simplexml.ini
    - /etc/php/7.4/cli/conf.d/20-sockets.ini
    - /etc/php/7.4/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.4/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.4/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.4/cli/conf.d/20-tokenizer.ini
    - /etc/php/7.4/cli/conf.d/20-xmlreader.ini
    - /etc/php/7.4/cli/conf.d/20-xmlwriter.ini
    - /etc/php/7.4/cli/conf.d/20-xsl.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

请在Ubuntu OS上运行以下命令.

Please run the below commands on Ubuntu OS.

  1. Sudo apt-get更新

  1. Sudo apt-get update

sudo apt-get install php-mbstring

sudo apt-get install php-mbstring