I found a script that was written for PHP5.3 and wanted to run it in PHP7 - someone rewrote some lines of that Code on Github but kind of only rewrote half of it. Now I have this Problem:
private static function connect() {
self::$link = @mysqli_connect( Config::$db['host'], Config::$db['user'], Config::$db['password'] )
or die( "Couldn't establish link to database-server: ".Config::$db['host'] );
mysqli_select_db( Config::$db['database'] )
or die( "Couldn't select Database: ".Config::$db['database']);
mysqli_query( 'SET NAMES utf8', self::$link );
}
This Code returns that it cannot connect to the Database.
[Tue Sep 20 08:51:50.384387 2022] [proxy_fcgi:error] [pid 3512728] [client 165.225.200.196:60932] AH01071: Got error 'PHP message: PHP Warning: mysqli_select_db() expects parameter 1 to be mysqli, null given in /var/www/vhosts/123file.li/httpdocs/lib/db.php on line 23\n'
I also tried adding Config::$db with all other Database Variables but it always says that it is unable to connect.
What could be the Problem?