How to fix laravel new project not working: not installed: openssl php extension?

Updated: Jan 27, 2025

How to fix laravel new project not working: not installed: openssl php extension?

When creating a new Laravel project using the laravel new command, you might encounter an error message stating that the OpenSSL PHP extension is not installed. This error occurs because Laravel relies on OpenSSL for some of its encryption and decryption functions. Here's how to fix this issue:

  1. Check if OpenSSL is installed:

Before attempting to install the OpenSSL PHP extension, you need to ensure that OpenSSL is installed on your system. You can check this by running the following command in your terminal or command prompt:

openssl version

If OpenSSL is installed, you should see the version number printed out. If not, you'll need to install OpenSSL first.

  1. Install OpenSSL:

The method for installing OpenSSL depends on your operating system. Here are some general instructions:

  1. Install the OpenSSL PHP extension:

Once OpenSSL is installed, you need to install the PHP extension. The method for installing the extension depends on your PHP configuration. Here are some general instructions:

  1. Verify the installation:

After installing the OpenSSL PHP extension, you should be able to create a new Laravel project without encountering the "not installed: openssl php extension" error. To verify that the extension is installed, you can run the following command in your terminal or command prompt:

php -m | grep openssl

If the OpenSSL PHP extension is installed, you should see "openssl" printed out in the list of installed modules.

  1. Create a new Laravel project:

Now that the OpenSSL PHP extension is installed, you should be able to create a new Laravel project without encountering the error. Run the following command to create a new project called "myproject":

laravel new myproject

This should create a new Laravel project without any issues related to the OpenSSL PHP extension.