Álvaro Franz
Álvaro Franz

Reputation: 811

PHP under Laragon - SSL operation failed with code 1

I am using Laragon 4.0.16 on Windows 10 to develop in PHP.

I enabled SSL using the Laragon tool to do so:

enter image description here

Also added laragon.crt to the Trust Store.

enter image description here

I can access my test project at https://project.test correctly.

But, there is an issue:

Warning: getimagesize(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

I have been reading that the way to fix such issue is to set curl.cainfo and openssl.cafile in the PHP ini configuration file.

I did so, in the Laragon global php.ini located at C:\laragon\bin\php\php-xxx\php.ini:

curl.cainfo = "C:\laragon\etc\ssl\cacert.pem"
openssl.cafile = "C:\laragon\etc\ssl\cacert.pem"

But after restarting Laragon, the php warning persists.

What else can I do to track down the problem and fix it?

Thank you.

Upvotes: 3

Views: 8031

Answers (1)

Axos
Axos

Reputation: 188

I tried figuring that issue out a couple of hours. All the solutions i found stated the following things:

  • Download the cacert from https://curl.haxx.se/ca/cacert.pem and replace the one in laragon/etc/ssl/
  • set the openssl.cafile in php.ini to laragon\etc\ssl\laragon.crt (e.g. openssl.cafile= "C:\laragon\etc\ssl\laragon.crt")

Didn't helpt at all. The thing that actually worked was to switch to php 7.3 (my code wasn't capable of running 7.4 and i ran into different errors there). The reason why seems to be that for php 7.2.19 the php_openssl.dll has the version 1.1.1b and the php_openssl.dll for version 7.3 and up has the version 1.1.1k.

That finally fixed the issue. I hope that helps someone couple of hours of madness. I'm not sure if this can occur again in future versions of php :)

Upvotes: 14

Related Questions