Why the intermediate step of writing values to array? Why not:
Be careful with relative path with regards to including in other pieces of code. If being included by code in another directory (particularly at a different level in directory structure), this may break. Also, you won't be able to include this file more than once within any given script execution since you are defining constants.
Since you can only include this once per execution, do you really need to define constants at all?
$connection = mysqli_connect(
I am just generally worried about your thinking of including this within other files "as needed". That tends to make me think that you don't have a good strategy around managing your application dependencies (such as database connection). Just sprinkling includes/requires throughout your code can really make your code fragile and hard to maintain. If you really want to take you application coding to another level, I would suggest familiarizing yourself with dependency injection, both in a philosophical sense as well as from a practical standpoint looking at typical PHP libraries that do this (Pimple, PHP-DI, or pretty much any popular framework has some level of dependency injection strategy).
Hopefully your ini file is separate from your codebase (i.e. not under revision control) to where you are storing your DB passwords in your code. If that is the case, consider taking the next step and have the ini file parsed in a different process such that this particular code is not responsible for reading configuration data from files that should perhaps should just be available in environmental variables.