Search code examples
phplaravelubuntuphp-extension

How to install all required PHP extensions for Laravel?


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

Solution

  • The Laravel server requirements specify the PHP extensions, including BCMath, Ctype, cURL, DOM, Fileinfo, JSON, Mbstring, OpenSSL, PCRE, PDO, Tokenizer, and XML, are required. These extensions are usually included and enabled during a PHP installation.

    You can use the following command in Ubuntu to check the necessary extensions.

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

    Installation specific to a particular version of PHP (such as PHP 8.3)

    sudo apt install openssl php8.3-bcmath php8.3-curl php8.3-json php8.3-mbstring php8.3-mysql php8.3-tokenizer php8.3-xml php8.3-zip
    

    Additional PHP extensions may be required for your composer packages. Refer to the links below for more information.

    PHP extensions for Ubuntu 24.04 LTS (Noble Numbat)

    PHP extensions for Ubuntu 22.04 LTS (Jammy Jellyfish)

    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)