Safety of AES ECB when used with openssl_seal function I'm trying to use PHP to encrypt files with a public key. I'm using the function openssl_seal that "encrypts data by using RC4 with a randomly generated secret key." 

RC4 is considered unsafe so the alternative is to use AES ECB, but it too is generally considered unsafe (AES CBC is sadly not an option).

My question is: 
Is AES ECB still unsafe, even when used with a randomly generated key, which is different for each file?
ECB is not secure even with per file keys, because if two blocks of the file are identical, this is visible in the ciphertext. The only * cases where ECB is secure is encrypting completely random data or encrypting a single block per key.

You should pick something more secure if your can help it.

If there is literally no other option than RC4 and AES ECB, you could use first RC4 and then AES ECB. RC4 would make it almost random and AES ECB would hide the biases. However, general concerns with cascaded ciphers would apply.

* Ok, fine, or if plaintext blocks are known to be unique, but that's rare and not the case here.