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

我需要让我的 Ubuntu 16.04。是否有使用 GUI 的方法,或者是使用终端的最简单的方法?

我已经安装了 PHP 7.1 MariaDB。

我需要启动:

  1. PHP 扩展
  2. PHP 扩展
  3. PHP 扩展
  4. Tokenizer PHP 扩展
  5. PHP 扩展
194011 次浏览

Laravel Server Requirements mention that BCMath, Ctype, JSON, Mbstring, OpenSSL, PDO, Tokenizer, and XML extensions are required. Most of the extensions are installed and enabled by default.

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

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)

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.

PHP extensions for Ubuntu 20.04 LTS (Focal Fossa)

PHP extensions for Ubuntu 18.04 LTS (Bionic)

PHP extensions for Ubuntu 16.04 LTS (Xenial)

**

New requirements for installing Laravel 8 and PHP 8:

**

sudo apt install php8.0-common php8.0-dom php8.0-bcmath openssl php8.0-mbstring

You can install PHP extensions like this:

sudo apt-get install php-xsl php-pgsql

Run the below command. It will install all required php8.1 extensions in Ubuntu

sudo apt install php8.1 php8.1-cli php8.1-common php8.1-mysql php8.1-zip php8.1-curl php8.1-gd php8.1-mbstring php8.1-xml php8.1-bcmath php8.1-fpm php8.1-phpdbg php8.1-cgi libphp8.1-embed libapache2-mod-php8.1