如何使用php包含/要求从另一台服务器连接到mysql文件

i have a connection file

file name inc.server.php

    <?php

function db_name() { return 'dbname'; }
function db_user() { return 'username'; }
function db_pass() { return 'pw'; }
 $koneknodatabase = mysqli_connect('localhost:2020',db_user(),db_pass(),db_name());
function close_Con() {
 mysqli_close(mysqli_connect('localhost:2020',db_user(),db_pass(),db_name()));
}
?>

this file save in the my server with IP : 10.2.60.2

but when i require that file from my local pc

with

require('http://10.2.60.2/inc.server.php');
global $koneknodatabase;
$select = mysqli_query($koneknodatabase,"select from data");
$data  = mysqli_fetch_array($select);

iam run that script on my localhost but the result is

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in

i have change allow_url_include to ON from php.ini please help

You can't access the source code of a PHP script of a remote host like that, otherwise everyone would open the config.php file from every webpage they know (and they know the file exists) and get any login data they want.

When you open the URL http://10.2.60.2/inc.server.php in your browser you see the content someone outside of the host "10.2.60.2" will see. It will be most likely an empty page since your inc.server.php file doesn't generate any output (and shouldn't). So your other PHP host will include just an empty file from his point of view, which means there aren't any functions like db_name() defined or any variables like $koneknodatabase.

There are different ways on how separated hosts can communicate to each other, but thats a different topic and might result in different questions. Luckily there are millions of informations out there about how two hosts can communicate with each other.