How to install all required PHP extensions for Laravel?

PhpLaravelUbuntuPhp Extension

Php Problem Overview


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?

I have already installed 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

Php Solutions


Solution 1 - Php

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)

Solution 2 - Php

**

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAipoView Question on Stackoverflow
Solution 1 - PhpMadan SapkotaView Answer on Stackoverflow
Solution 2 - PhpPaulView Answer on Stackoverflow