How to enable PHP’s openssl extension to install Composer ?


To enable PHP's openssl extension to install Composer, you can follow the below methods:

Method 1: Enable openssl extension in php.ini file

  • Locate the php.ini file in your PHP installation directory.
  • Open the php.ini file in a text editor.
  • Search for the line ;extension=openssl and remove the semicolon (;) at the beginning of the line to uncomment it.
  • Save the changes to the php.ini file and close it.
  • Restart your web server or PHP service to apply the changes.

Method 2: Enable openssl extension using command line

  • Open the command prompt or terminal on your system.
  • Run the following command to enable the openssl extension:

For Windows:

   php -d extension=php_openssl.dll

For Linux/Mac:

   php -d extension=openssl.so
  • Once the openssl extension is enabled, you can install Composer using the command line or by downloading the installer from the official website.

Method 3: Enable openssl extension using XAMPP

If you are using XAMPP on Windows, you can enable the openssl extension by following these steps:

  • Open the XAMPP Control Panel.
  • Click on the "Config" button next to the Apache module.
  • Select "PHP (php.ini)" from the dropdown menu.
  • Search for the line ;extension=openssl and remove the semicolon (;) at the beginning of the line to uncomment it.
  • Save the changes to the php.ini file and close it.
  • Restart the Apache module in XAMPP.

After enabling the openssl extension using any of the above methods, you can install Composer by following the official installation instructions.



About the author

William Pham is the Admin and primary author of Howto-Code.com. With over 10 years of experience in programming. William Pham is fluent in several programming languages, including Python, PHP, JavaScript, Java, C++.