openssl_private_encrypt和“错误:0E06D06C ... NCONF_get_string:没有值”

I can generate all keys fine, when I go to encrypt the file I get an error thrown at me: error:0E06D06C:configuration file routines:NCONF_get_string:no value but googling and checking stackoverflow only shows people with problems generating the keys. My code: Here

EDIT: The error pops up when I put or die(openssl_error_string()); after openssl_private_encrypt($fileToEnc, $encFile, $privateKey) but I am now getting fwrite() expects parameter 1 to be resource, boolean given in C:\wamp\www\xr1\encrypt.php on line 9

There was an error in my fopen dir somehow and it just broke. It is all good and fixed now, thanks.