2

I'm trying to use Phalanger to compile a script I wrote in PHP into a standalone executable. The script utilizes PHP's cURL extension to make various REST calls. This actually works fine so long as the websites it hits use http; however it fails any time I try to hit https endpoints.

I have tried adding this line into the PHP source:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

That would just ignore any SSL validation; however it doesn't work. It actually does work if I run the script in PHP, but when I compile it using Phalanger to an executable, it spits out this warning:

Warning: curl_setopt(): Value 'False' of argument 'value' is not supported in C:\test.exe on line 76, column 2.

So, okay, that means I absolutely have to validate SSL? Sure, fine. So I found a certificate store on cURL's website, downloaded it, and changed my line above to the following:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_CAINFO, realpath(getcwd() . '/cacert.pem'));

Now when I compile it and run the executable, I get this warning instead:

Value 'CURLOPT_CAINFO' of argument 'option' is not supported in C:\test.exe on line 77, column 2.

It seems I just can't win. How can I get cURL working through PHP compiled by Phalanger, over HTTPS?

soapergem
  • 9,263
  • 18
  • 96
  • 152
  • This option has been disabled in Phalanger for performance reasons. Certificate should be added to windows certificates storage. See note on https://github.com/DEVSENSE/Phalanger/blob/8cdb36e81a7d6b1952bd054d52e6a8706a05d06b/Source/Extensions/Curl/UserDefined.cs#L1110 – Jakub Míšek Oct 01 '16 at 15:29

0 Answers0