Warning This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. If the PHP directive mysql.default_host is undefined (default), then the default value is 'localhost:3306'.Instead, the My SQLi or PDO_My SQL extension should be used. In SQL safe mode, this parameter is ignored and value 'localhost:3306' is always used.As long as your don't have multiple, possibly untrusted, users on your machine then that's OK.But when you are running a large multi-user service with thousands of users its always possible that one of them will look at your files and take a note of the passwords you have in them.
This causes problems with mysql/networking because a new port is requested for each connection.This is for when mysql_ping() doesn't work for your situation of course. You can use mysql_connect in a function to connect to a database and the connection is a super-global...meaning you can use mysql_query in other functions or in no function at all and PHP will use the connection that you opened.The addition of entries to to stop files being served by Apache is certainly useful and to be recommended.But it doesn't change the fact that these files have to be readable by Apache so that the PHP processor can get at them.
This is a handy bit of knowledge that helps if you have a large site with lots of scripts.