The usage of openssl_pkey_new() in the example above is wrong.
openssl_pkey_new() requires an array as first parameter
Working example for openssl_pkey_new():
http://php.net/manual/de/function.openssl-pkey-new.php#111769