I know this question has been answered in other threads, but having the same problem and not finding the solution for my case in the given answers, I found a different solution for my case and that took me a while to find out, and since I can't reply to those other questions because I have only 1 reputation point, I post it as a new question.
The problem in my case was, that the "extension_dir" setting in my php.ini was wrong, because originally I had installed PHP in a different directory and then moved it manually.
So, if you checked your php.ini and found openssl enabled and still got that error, you may want to also check extension_dir in php.ini, if it points to where you expect it, and if the directory actually contains the openssl module.