I am playing around in PHP with RSA and big numbers. I need to be able to take numbers to the power of an exponent that has ~256 to ~512 bytes using gmp_pow(). Does anyone have any suggestions?
You should use gmp_powm() which automatically reduces the intermediate values to be less than the modulus value. This exactly what you want for RSA.
gmp_pow() doesn't accept an exponent large than a long since the intermediate values will be larger than the addressable memory in your computer.