Finally figured out the solution as per following link :
MCRYPT_RIJNDAEL_128 is not the same as
MYCRYT_RIJNDAEL_128 the 128 actually refers to block size not key size, in
AES-128-CBC the 128 refers to key size, i.e. they are both
AES-256 when used with a valid 256-bit key.
In the PHP code, changing $cipher in function encrypt() to 'AES-256-CBC' from 'AES-128-CBC' helps us get the required output using openssl_encrypt.