I just recommend you to install CWP again on a new fresh system and make sure there are no errors during the installation. Or copy the dovecot's, roundcube's database structure from some live server and recreate mailboxes on the new server.
As an extra step for investigation, check the php libs available for main php version installed on your server. It must support MySQLi, and PDO_mysql.