I just fixed a similar problem, WHM and Cpanel + WP all had the memory limits set to 2GB but I was still getting an out of memory error in WP (PHP), it was reading the correct limits set in the user.ini, php.ini and .htaccess but the persisted.
In WHM, Apache configuration -> Memory Limits. (RLimitMEM)
Set that limit to match your PHP limits.