It’s pretty smooth to upgrade from the old mysql to the new mysqli functions in PHP. Most of them are the same, and documented well on the php.net website.
However if you’re clients have configured database server names back in mysql_connect() days then they may have added the port number or socket to the mysql hostname like this:
When these are passed into your new updated mysqli_connect() call they will not work. You have to specify these port/socket arguments separately.
Here’s a basic script to split them out and support those who have setup their scripts prior to mysqli_connect() days: