skip to Main Content

I know this question is all over the place on this site, but all the solutions haven’t worked with me.

I get this error when running composer install:

In Factory.php line 650:

  The openssl extension is required for SSL/TLS protection 
  but is not available. If you can not enable the openssl
  extension, you can disable this error, at your own risk, 
  by setting the 'disable-tls' option to true.

I don’t know where it’s getting Factory.php from but it’s not in my project directory.

I did all the proposed solutions. I renamed my PHP’s php.ini-development file to php.ini, and uncommented the following:

extension=openssl

And since I’m on windows, this too:

extension_dir = "ext"

I have also enabled SSL through Laragon menu > Apache > SSL > Enable

My php.ini file is located in my laragon folder like this:

C:laragonbinphpPHP7php.ini

Then I noticed something: when I right-click on Laragon for the menu and go to php.ini, it says no php.ini file located (even though it’s in the right spot.) As seen in the attached photo.

When all that didn’t work, I saw another proposed solution that said to add the php.ini file to Apache’s directory within Laragon as well, like this:

C:laragonbinapachehttpd-2.4.54-win64-VS16binphp.ini

Note that I’m reloading Apache every time.

And I still get the error.

What could possibly be the problem? I don’t want to disable-tls and I have no idea what the Factory.php file is.

Any help is appreciated. Thanks.

2

Answers


  1. Chosen as BEST ANSWER

    I've found the solution. To anyone else who needs it:

    It's everything I did above, then as an initial step, what the other answer said which solves the "no file found" popup. But to solve the rest, I've figured out my problem was that before I did everything above in php.ini, I switched the php version Laragon was using (v8) to v7.4 (the one I've been trying to get to work.) This, for some reason, confuses Composer. So I had to uninstall composer itself from my computer and reinstall, but activate developer option by checking it in the installation wizard this time since I hadn't the first time around. After that, it worked.


  2. I think what you’re missing in this case is a certificate for your PHP instance.

    You can download this certificate file directly from: CURL’s site

    After that what you need to do is look for these entries in your php.ini file. Specifically [curl] and [openssl] which is right after [curl].

    What you need to do is save the cacert.pem file in a location preferably in a directory in your web server’s root directory or where you prefer and use the absolute directory for the configuration below.

    [curl]
    ; A default value for the CURLOPT_CAINFO option. This is required to be an
    ; absolute path.
    curl.cainfo = "absolute location of where you saved the cacert.pem file"
    
    [openssl]
    ; The location of a Certificate Authority (CA) file on the local filesystem
    ; to use when verifying the identity of SSL/TLS peers. Most users should
    ; not specify a value for this directive as PHP will attempt to use the
    ; OS-managed cert stores in its absence. If specified, this value may still
    ; be overridden on a per-stream basis via the "cafile" SSL stream context
    ; option.
    openssl.cafile= "absolute location of where you saved the cacert.pem file"
    

    Save the php.ini file, restart your server and try again. This should solve your issue.

    UPDATE

    If you check your PHP info phpinfo() you should have a section similar to this one:
    phpinfo() openssl

    If you don’t you’re probably not enabling openssl.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search