For Connecting databse with php your local server you can use xampp server :
Learn how to install Xampp server in local computer to check this link https://www.webdesigninghouse.com/tutorials/php-installation-with-examples
PHP Connect to MySQL :
Since PHP 5.5, mysql_connect() extension is deprecated. Now it is recommended to use one of the 2 alternatives.
Earlier versions of PHP used the MySQL extension. However, this extension was deprecated in 2012.
Which one should we use MySQLi or PDO ?
Connection to MySQL using MySQLi
It can be done in two ways:
MySQLi Object-Oriented
MySQLi Procedural :
Connection to MySQL using PDO