RSA and PHP

Hi,

I am trying to encrypt a string on PHP using RSA which should then be
decrypted by Ruby on Rails. In PHP, I am using the following commands:

$fp = fopen(...);
$pKey = fread($fp, filesize(...));
openssl_public_encrypt($data, $enc, $pKey);
return base64_encode($enc);

On Ruby on Rails, I get the following error: "padding check failed"

I already tried all padding configurations possible in PHP without
success.

Has anyone managed to exchange RSA strings between PHP and Ruby?

Cheers,
joana