Home >Backend Development >PHP Tutorial >Why am I getting an 'SSL/TLS Protection Error' when creating a Flarum project with Composer?

Why am I getting an 'SSL/TLS Protection Error' when creating a Flarum project with Composer?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-06 02:15:02311browse

Why am I getting an

SSL/TLS Protection Error in Composer

The Issue:

When attempting to create a new Flarum project using Composer, users may encounter the following error:

The openssl extension is required for SSL/TLS protection but is not available.

This error indicates that the PHP OpenSSL extension, necessary for secure network communication, is not enabled in the PHP configuration.

The Solution:

  1. Disable TLS for Composer (Unsecured):

    Warning: This method is not recommended for production environments and should only be used on development machines where security is not a major concern.

    composer config -g -- disable-tls true
  2. Enable PHP OpenSSL Extension:

    To properly enable OpenSSL, users should ensure that the PHP OpenSSL extension is both installed and enabled in their php.ini file.

    Linux/OSX: Add or uncomment the following line in php.ini:

    extension=php_openssl.so

    Windows: Add or uncomment the following line in php.ini:

    extension=php_openssl.dll

    Reload the web server or PHP-FPM to apply the changes.

    Note: In PHP versions 7.4 and above, the extension name is extension=openssl instead.

  3. Restart Composer:

    After making the necessary changes, restart Composer to resolve the error.

Additional Notes:

It is highly recommended to enable the PHP OpenSSL extension for secure network communication. Disabling TLS for composer should only be considered a temporary solution for development environments.

The above is the detailed content of Why am I getting an 'SSL/TLS Protection Error' when creating a Flarum project with Composer?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn