This error has nothing to do with your code. PDO is a built-in PHP class and in case it is not found, it is not configured for your new system web-server. It should be enabled in php.ini. To verify, you can run phpinfo() in your new system and see if you can find PDO mentioned on the page.
The only other possibility is that your new system is using namespaces and in this case you should address PDO as \PDO.
Thank you for the tip. but mean time my managed server provider had managed to solve the issue. this is what they said.
The issue has now been resolved.
On checking, I could see that you have been using some custom setup to
load PHP config files from the location
/var/lib/php/liberal/fazihuz3/php.ini which did not have PDO class
listed in its modules and this is why you ended up in the error.
I renamed the location so that the default PHP configs are loaded from /usr/local/lib/php.ini.
Thank you every for the replies. really appreciate it…
This worked and the sites display the PDO connection just fine.