Sunday, 16 November 2025

PHP Composer 'Certificate Verify Failed' Alternate Solution | Windows 10

 


Commands (for activating virtualization) :

1.

dism.exe /online /enable-feature /featurename:Microsoft-Hyper-V-All /all /norestart


2.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart


3.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart


4.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart


5.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart



Commands (for installing PHP and composer) :

1.

sudo apt update


2.

sudo apt install apache2 php libapache2-mod-php

3.

sudo service apache2 start

4.

sudo apt install composer


========================



The Composer installer script was not successful [exit code 1].


OpenSSL failed with a 'certificate verify failed' error. This indicates a problem with the Certificate Authority file(s) on your system, which either cannot be found or may be out of date.


Script Output: The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: error:XXX:SSL routines:tls_process_server_certificate:certificate verify failed Failed to enable crypto failed to open stream: operation failed



========================


When I try to install composer for PHP on windows 10 in different machines, Sometimes I face errors like this. So I was wondering if there is any alternate solution to this where I do not have to switch the whole operating system and be able to download the vendor folder using composer. I found that there is a way to do it in Windows 10. It's called WSL aka windows subsystem for Linux. For all of you experienced people out there already figured out what will be next. So this tutorial is for beginners. With WSL, you can access linux files from windows. So what we do is to install php & composer in linux, download the required vendor folder and copy it in windows.

So before installing WSL, make sure that your virtualization is on. You can check it by opening the task manager, opening the performance tab and looking for virtualization. It has to be enabled, if not, go to your BIOS setting and enable it. For different motherboards & processors, you will find it on different menus. Once you enable it, open the task manager again and check it. Once it is enabled, go to the Microsoft store, download Ubuntu 24.04. After executing Ubuntu, if you see an error, then open powershell in the Administrator. Run following commands. I mentioned them at the beginning of post.

After that, it should not show any error and ask you to give your username and password. I am using Ubuntu as my username and password. You can choose your own.

Better to update the OS.

Now, it is time to install PHP, apache2 and composer. 

Make sure to install your required version of PHP before installing composer.

We shall go to the root folder by using cd .. command.

Lets go to the var/www/html folder in the linux terminal.

If you open windows explorer, you can open linux files by typing \\wsl$ in explorer’s path textbox.

You can also find linux at tree explorer at the bottom.

Open linux terminal, and make sure to make chmod 777 to html folder. With that, creating/editing/deleting files inside that folder will be very easy.

Let’s create a single folder to check if it works.

Let’s download the vendor folder using the composer command.

Once downloaded, you can copy-paste vendor folders in your PHP projects which are present in windows machines like xampp/wamp etc.

Thanks for watching.