How to Install All Required PHP Extensions for Laravel

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)

How to install php-xml extension in windows?

Download them from PHP Extension Community Library (PECL)

For example this is the php_zip source that you need:

https://pecl.php.net/package/zip/1.12.4/windows

Similarly you can get the rest of them.

When installing just PHP on Windows, all php extensions are commented out by default?

Can I just uncomment all extensions or is there a reason that's a bad idea?

Yes, you can uncomment all extensions, but that won't improve your user experience :)

In general: enable only PHP extensions, you really need

The more dynamic extensions PHP needs to load, the more stuff it has to load and process during startup and the more time it takes. So, the startup will be slower.

For instance, enabling the default extension php_pdo_firebird.dll doesn't gain you anything, except, when you really want to access the Firebird database from PHP via PDO.

Is there a way to get a .ini file that has the most common stuff available?

The PHP extensions shipped by PHP itself are all listed in php.ini.
There is also php.ini-development with some dev configurations.

If everything is off by default, then i suggest to enable curl + openssl, mysql, sqlite, mbstring for a start, because:

  • Curl and Openssl are needed to get Composer running,
  • Mysql and Sqlite to support these often used databases,
  • mbstring for UTF8 stuff
  • and whenever some library meows enable some more ,)

can't install laravel 8

Maybe you can try to do this. Run this command :

composer install --ignore-platform-reqs

Or

composer update --ignore-platform-reqs


Related Topics



Leave a reply



Submit