Are you sure there isn’t any whitespace, newlines or anything of the sort that might be interfering? Use trim().
It seems to be the PHP one that’s the problem. This online generator clearly uses PHP and it outputs the same as what your MySQL is producing. So the problem must lie with whatever you’re passing to to PHP’s md5().