I got 2 questions regarding them, assuming I got a file called config.php and it is being included in all pages by php require.
In config php I got these 2 lines:
$mysqli = new MySQLi('p:127.0.0.1', 'x', 'y', 'z');
$mysqli->set_charset('utf8');
Is it ok that its being called on every page? (does it knows automatically to reuse old connections rather than creating a new one?)
Connecting to MySQL isn’t configuration. The authentication info to connect to MySQL such as; username, password, db, and port is but establishing the connection falls under bootstrapping NOT configuration. Most modern applications even defer connecting until the connection is needed. So putting that in a file called config.php is kind of a sloppy, unorganized way to go about it.