-1

I have an Alfred workflow that needs to pull image files from remote servers. Up until recently, this was working fine until I suddenly started getting errors from imagecreatefromgif():

SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

And:

Failed to enable crypto.

It happens with any https URL, so it's not the encryption on the remote server. After a ton of Googling, I ran the script in this answer and the wrappers look good:

openssl: yes
http wrapper: yes
https wrapper: yes
wrappers: array (
    0 => 'https',
    1 => 'ftps',
    2 => 'compress.zlib',
    3 => 'compress.bzip2',
    4 => 'php',
    5 => 'file',
    6 => 'glob',
    7 => 'data',
    8 => 'http',
    9 => 'ftp',
    10 => 'phar',
    11 => 'zip',
)

PHP configuration is kind of outside my wheelhouse, so I'm a bit lost. I have no idea why my mac's PHP install has lost the ability to read files over https.

Anyone have any insights?

Community
  • 1
  • 1
shireling
  • 21
  • 4
  • It sounds like a CORS issue : https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS – DevlshOne Dec 14 '16 at 20:32
  • or the local onenssl is not up to date –  Dec 14 '16 at 20:35
  • Please show your code or risk the question being closed. – jww Dec 14 '16 at 22:45
  • @jww the code is included above - it's a simple imagecreatefromgif() that is trying to read a remote .gif file through https. – shireling Dec 14 '16 at 23:08
  • @Dagon I ran `openssl version` and it came back with `OpenSSL 0.9.8zh 14 Jan 2016` - sorry in advance for my ignorance, but does that support your theory? If so, any thoughts on what version I should have and perhaps a tip/link on how to go about updating it? Thanks so much! :) – shireling Dec 14 '16 at 23:39
  • cant promise it would work but you should still upgrade –  Dec 15 '16 at 00:06
  • According to the [`imagecreatefromgif` man page](https://secure.php.net/manual/en/function.imagecreatefromgif.php): *"imagecreatefromgif() returns an image identifier representing the image obtained from the given filename"*. There's more going on that you claim, especially if you are using a URL. Please provide your reproducer, and include the URL. – jww Dec 15 '16 at 00:15
  • @jww "A URL can be used as a filename with this function if" ... i think he is obviously doing that, and the file is hosted on a server host with https –  Dec 15 '16 at 00:29
  • Thanks @dagon [This answer](http://apple.stackexchange.com/questions/126830/how-to-upgrade-openssl-in-os-x) helped me find that I actually had 1.0.2j installed but not linked. Linking that didn't solve the problem, but at least I can rule this out now :) – shireling Dec 15 '16 at 00:31
  • @Dagon - the function is failing because of a supposed bad certificate. He needs to provide the code with the URL, or provide the certificate so we can begin to diagnose it. The URL would be easiest so we could also check the remote server config. Why the hell should we keep guessing??? – jww Dec 15 '16 at 00:40
  • @jww you dont have to guess, if you dont want to, S.O is not compulsory :-) (blink twice if someone is holding a gun to your head) –  Dec 15 '16 at 00:42
  • I only wish the problem were limited to a specific URL - any https url causes a problem for me. The url is fed into the workflow, saved as a variable, and passed to the function: `imagecreatefromgif( $originalgif );` – shireling Dec 15 '16 at 00:52
  • @dagon I managed to get it working. Thanks so much for taking the time to be so helpful! – shireling Dec 16 '16 at 22:57

1 Answers1

2

Finally figured it out - after searching a searching I stumbled upon this insanely helpful post: https://akrabat.com/ssl-certificate-verification-on-php-5-6/

Followed those steps and everything now works perfectly.

shireling
  • 21
  • 4