How to install all required PHP extensions for Laravel?

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.2)

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

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

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)

Leave a Comment