如何为 Laravel 安装所有必需的 PHP 扩展?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40815984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:15:26  来源:igfitidea点击:

How to install all required PHP extensions for Laravel?

phplaravelubuntuphp-extension

提问by pvaitonis

I need to make my Ubuntu 16.04. Is there a way using the GUI or is the simplest way to do this by using terminal?

我需要制作我的 Ubuntu 16.04。有没有办法使用 GUI 或者是使用终端来做到这一点的最简单方法?

I have already installed PHP 7.1, MariaDB.

我已经安装了 PHP 7.1,MariaDB。

I need to enable:

我需要启用:

  1. OpenSSL PHP Extension
  2. PDO PHP Extension
  3. Mbstring PHP Extension
  4. Tokenizer PHP Extension
  5. XML PHP Extension
  1. OpenSSL PHP 扩展
  2. PDO PHP 扩展
  3. Mbstring PHP 扩展
  4. 分词器 PHP 扩展
  5. XML PHP 扩展

回答by Madan Sapkota

Laravel Server Requirementsmentions that BCMath, Ctype, JSON, Mbstring, OpenSSL, PDO, Tokenizerand XMLextensions are required. Most of the extensions are installed and enabled by default.

Laravel服务器要求提到BCMathCtypeJSONMbstringOpenSSLPDOTokenizerXML需要扩展。默认情况下,大多数扩展都已安装并启用。

You can run the following command in Ubuntu to make sure the extensions are installed.

您可以在 Ubuntu 中运行以下命令以确保安装了扩展。

sudo apt install openssl php-common php-curl php-json php-mbstring php-mysql php-xml php-zip

PHP version specific installation (if PHP 7.4 installed)

PHP 版本特定安装(如果安装了 PHP 7.4)

sudo apt install php7.4-common php7.4-bcmath openssl php7.4-json php7.4-mbstring

You may need other PHP extensions for your composer packages. Find from links below.

您的 Composer 包可能需要其他 PHP 扩展。从下面的链接中查找。

PHP extensionsfor Ubuntu 16.04 LTS (Xenial)

适用于 Ubuntu 16.04 LTS (Xenial) 的PHP 扩展

PHP extensionsfor Ubuntu 18.04 LTS (Bionic)

适用于 Ubuntu 18.04 LTS (Bionic) 的PHP 扩展