equivalent of mysql aes_decrypt in php?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I am using AES_DECRYPT and AES_DECRYPT to store my datat in mysql
databases. I want to  be able to download these as csv files and have a
php script decrypt them. I can use bin2hex to convert to text , but I
cant figure out how to decrypt the hex to plaintext using php? I have
tried this without success, as AES is not recognized.

$input = 'some encrypted data in hexadecimal';

$len = strlen ( $input );
$input = pack("H" . $len, $input );

$td = mcrypt_module_open( 'AES' , '', 'ecb', '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td),  MCRYPT_RAND );
mcrypt_generic_init($td, $key, $iv);

$decrypted =  mdecrypt_generic($td, $input );

Site Timeline