PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 29, 2022

[FIXED] OpenSSL error with Composer PHP package manager

 January 29, 2022     composer-php, openssl, php     No comments   

Issue

When I attempt to run composer install in the CLI, I get this error:

You must enable the openssl extension to download files via https

The problem seems to be on line 5381 of my composer.phar file:

if (!extension_loaded('openssl') && (0 === strpos($url, 'https:') || 0 === strpos($url, 'http://github.com'))) {
    throw new \RuntimeException('You must enable the openssl extension to download files via https');
}

I have enabled the openssl extension in both my php.ini files. (Apache and PHP)

If I run openssl version in the CLI it returns

OpenSSL 1.0.1c 10 May 2012

I ran the following PHP script through my WAMP server:

echo extension_loaded('openssl');

It printed 1

As far as I can tell, my openssl extension is working fine, but for some reason it is still causing this error for Composer.

Does anyone see any problems I may have overlooked?


Solution

There is a difference between PHP running inside a HTTP server, and on command line - both cases use their own configuration, so it might be that your command line version has not SSL extension configured.

Check for yourself: php -i shows you the phpinfo output on the command line. Any OpenSSL to be seen?

While you are at it, use the same output, locate the info on which php.ini is being used, and add the OpenSSL extension.



Answered By - Sven
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing