Install PHP extensions for Laravel 8 on Ubuntu
In our previous post we saw how to install PHP extensions in Ubuntu. In today's post we will install all those extensions required in Laravel 8. For the purposes of this post, we will assume that you have the latest version of Ubuntu, which in this case is 20.04 (Focal Fossa), and that you have previously installed PHP 7.4.
Requirements
Laravel 8 requires the following extensions.
- PHP >= 7.3
- BCMath PHP Extension
- Ctype PHP Extension
- Fileinfo PHP extension
- JSON PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PDO PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
Installation
To install these extensions just run the following command.
sudo apt-get install php7.4-intl php7.4-bcmath php7.4-common php7.4-json php7.4-mbstring openssl php7.4-xml
The Tokenizer, PDO, and Fileinfo extensions are part of php-common. Other extensions that you may need if you consume web services are soap and curl.
sudo apt-get install php7.4-soap php7.4-curl
If you are going to use MySQL as your database, you will also need to install the following extension.
sudo apt-get install php7.4-mysql
If you also plan to use Redis for queues you will need to install php-redis.
sudo apt-get install php-redis
And if you are developing and your redis server is on the same machine you will need to install the redis server.
sudo apt-get install redis-server