cURL on Windows: problems with SSL certificates

Sometimes, the following warning may be seen when running an extension that uses cURL on Windows.

SSL certificate problem: unable to get local issuer certificate

This is due to the fact that libcurl shipped with PHP is built without the support for the Windows certificate store, and so cURL cannot use it.

  1. Download a current certificate

    https://curl.haxx.se/ca/cacert.pem

  2. Place the certificate file anywhere inside the extension folder

    For example, it can be placed inside the externals folder: PATH_TO\plib\library\externals\cacert.pem

    Example: https://github.com/plesk/ext-route53/blob/master/src/plib/library/externals/cacert.pem

  3. Add the path to the certificate file in cURL options array

    Example: https://github.com/plesk/ext-uptime-robot/blob/master/plib/library/API.php#L114