要启用扩展,请验证它们是否已在这些 .ini 文件中启用 - Vagrant/Ubuntu/Magento 2.0.2

To enable extensions, verify that they are enabled in those .ini files - Vagrant/Ubuntu/Magento 2.0.2

通过 composer 安装 Magento 2.0.2 时出现此错误:

Problem 1
 - Installation request for magento/product-enterprise-edition 2.0.2 -> satisfiable by magento/product-enterprise-edition[2.0.2].
 - magento/product-enterprise-edition 2.0.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.

To enable extensions, verify that they are enabled in those .ini files:

- /etc/php5/cli/php.ini
- /etc/php5/cli/conf.d/05-opcache.ini
- /etc/php5/cli/conf.d/10-pdo.ini
- /etc/php5/cli/conf.d/20-curl.ini
- /etc/php5/cli/conf.d/20-imap.ini
- /etc/php5/cli/conf.d/20-json.ini
- /etc/php5/cli/conf.d/20-mcrypt.ini
- /etc/php5/cli/conf.d/20-pdo_pgsql.ini
- /etc/php5/cli/conf.d/20-pgsql.ini
- /etc/php5/cli/conf.d/20-pspell.ini
- /etc/php5/cli/conf.d/20-readline.ini

You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

我安装了php5-cli,php5-curl。

扩展的确切名称取决于您从中获取 PHP 的存储库,但请查看 here。例如在 CentOS 上:

yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-bcmath

首先安装 sudo apt-get install php5-gd,然后 sudo apt-get install php5-intl,最后安装 sudo apt-get install php5-xsl。 之后,它会按预期安装。

这个命令可以解决问题

sudo apt-get install php5-curl

对我来说

sudo apt-get install php5-mcrypt 

解决了问题

这解决了我的问题

sudo apt-get install php7.1-xml

或更高版本(* = 您的 php 版本)

sudo apt-get install php7.*-xml

首次安装

sudo apt-get install php5-gd

然后

sudo apt-get install php5-intl

最后一个是

sudo apt-get install php5-xsl

之后,它正在按预期安装。

试了很多次,上面的答案都没有解决我的问题,但是这个命令帮助了我:

sudo apt-get install php-mbstring

@Verse 答案很好。但是我想补充一点。 而不是安装 php5-mbstringphp5-gdphp5-intlphp5-xsl。这个答案是基于@Regolith 的回答: .

根据你的php版本安装。

首先通过 sudo php -v 检查你的 php 版本。我有 php7 所以结果是:

PHP 7.0.28-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
   with Zend OPcache v7.0.28-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

因为我有 php7,我将执行以下操作来列出 php 包:
sudo apt-cache search php7-*

这个返回

libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php-all-dev - package depending on all supported PHP development packages
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dev - Files for PHP7.0 module development
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-json - JSON module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-readline - readline module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php7.0-bcmath - Bcmath module for PHP
php7.0-bz2 - bzip2 module for PHP
php7.0-enchant - Enchant module for PHP
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.0-imap - IMAP module for PHP
php7.0-interbase - Interbase module for PHP
php7.0-intl - Internationalisation module for PHP
php7.0-mbstring - MBSTRING module for PHP
php7.0-mcrypt - libmcrypt module for PHP
php7.0-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.0-soap - SOAP module for PHP
php7.0-sybase - Sybase module for PHP
php7.0-xsl - XSL module for PHP (dummy)
php7.0-zip - Zip module for PHP
php7.0-dba - DBA module for PHP

现在安装包 运行 使用您想要的包的以下命令

sudo apt-get install -y php7.0-gd, php7.0-intl, php7.0-xsl, php7.0-mbstring

注意: php7.0-mbstring, php7.0-gd php7.0-intl php7.0-xsl 是上面列出的包.

更新: 不要忘记重启 apache/<your_server>

sudo service apache2 reload

在 Ubuntu 16.04 php7 现在是默认设置,所以如果您按照最热门的答案进行操作但仍然遇到此问题,请检查您的 php 版本。

php --version

如果您的默认 php 版本是 php7,但您使用 php5 个包进行了回答,您可以使用以下命令设置 [=17] 的默认版本=] 至 php5.6:

sudo update-alternatives --set php $(which php5.6)

当我去创建一个laravel项目时,我遇到了这个问题。

谷歌搜索后,我得到了这个解决方案。

我遵循了这些步骤:

第 1 步:sudo apt-get install -y php7.2-gd

第 2 步:sudo apt-get install php7.2-intl

第 3 步:sudo apt-get install php7.2-xsl

第 4 步:sudo apt-get install php7.2-mbstring

我用下面的方法解决了问题

yum install -y php-intl php-xsl php-opcache php-xml php-mcrypt php-gd php-devel php-mysql php-mbstring php-bcmath

在看到一些声称 "do the trick" 的答案(包括已接受的答案)后,将在此处 post 这个答案。首先,我们需要在解决问题之前确定问题。

the requested PHP extension gd is missing from your system.

如上行明确指出,我们需要安装扩展 php-gd。

因此,我们可以使用 sudo apt install php<version>-gd,它应该会修复此错误,除非系统需要更多扩展,而这恰好是所讨论系统中的确切情况。它需要更多的扩展 php-intl 和 php-xsl。 所以让它成为 mbstring 或 mcrypt,你应该安装你的系统缺少的任何扩展。你怎么能找到丢失的东西?只需阅读错误消息,它就在那里。

ubuntu 位用户尝试这个

apt-get install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-gd php7.2-mysql php7.2-curl php7.2-intl php7.2-xsl php7.2-mbstring php7.2-zip php7.2-bcmath php7.2-soap php-xdebug php-imagick

这适用于 php 7.2,但您可以将此 7.2 更改为 5.2 和 运行 此命令 这是工作。

它帮助我安装了正确的 curl 版本

sudo apt-get install php5-curl
  1. 在任何编辑器中打开 xampp/php/php.ini 文件
  2. 搜索“;extension=php_intl.dll”
  3. 删除起始分号 ( ; )

喜欢: ;extension=php_intl.dllextension=php_intl.dll

这对我有帮助。

已更新....ubuntu 用户

sudo apt-get install libapache2-mod-php php-common php-gd php-mysql php-curl php-intl php-xsl php-mbstring php-zip php-bcmath php-soap php-xdebug php-imagick

这是我尝试在新安装的 WSL 上安装 Laravel 时的修复方法:

sudo apt-get install php7.2-gd

sudo apt-get install php7.2-intl

sudo apt-get install php7.2-xsl

sudo apt-get install php7.2-zip

我遵循了这些步骤:

步骤 1:sudo apt-get install php5-gd

步骤 2:sudo apt-get install php5-intl

步骤 3:sudo apt-get install php5-xsl

之后,它会按预期安装。

正在安装 PHP 扩展:

sudo apt-get install -y php-gd

sudo apt-get install -y php-intl

sudo apt-get install -y php-xsl

sudo apt-get install -y php-mbstring

类似案例:

  • /etc/php/7.3/cli/php.this
  • /etc/php/7.3/cli/conf.d/10-mysqlnd.this
  • /etc/php/7.3/cli/conf.d/10-opcache.this
  • /etc/php/7.3/cli/conf.d/10-pdo.this
  • /etc/php/7.3/cli/conf.d/20-calendar.this
  • /etc/php/7.3/cli/conf.d/20-ctype.this
  • /etc/php/7.3/cli/conf.d/20-exif.this
  • /etc/php/7.3/cli/conf.d/20-fileinfo.this
  • /etc/php/7.3/cli/conf.d/20-ftp.this
  • /etc/php/7.3/cli/conf.d/20-gettext.this
  • /etc/php/7.3/cli/conf.d/20-iconv.this
  • /etc/php/7.3/cli/conf.d/20-json.this
  • /etc/php/7.3/cli/conf.d/20-mbstring.this
  • /etc/php/7.3/cli/conf.d/20-mysqli.this
  • /etc/php/7.3/cli/conf.d/20-pdo_mysql.this
  • /etc/php/7.3/cli/conf.d/20-phar.this
  • /etc/php/7.3/cli/conf.d/20-posix.this
  • /etc/php/7.3/cli/conf.d/20-readline.this
  • /etc/php/7.3/cli/conf.d/20-shmop.this
  • /etc/php/7.3/cli/conf.d/20-sockets.this
  • /etc/php/7.3/cli/conf.d/20-sysvmsg.this
  • /etc/php/7.3/cli/conf.d/20-sysvsem.this
  • /etc/php/7.3/cli/conf.d/20-sysvshm.this
  • /etc/php/7.3/cli/conf.d/20-tokenizer.this

解决方法:

apt-get install php-dom
apt-get install php-mbstring