Does the PHP method parse_ini_file work on an INI file hosted in the cloud? Right now, I have a config file that sits in every single one of my App servers, which could be anywhere from 4-8 at any given time. Making a config change is brutally painful to do by hand for each server.
I've tried the following but to no avail:
$handle = fopen('https://blah.com/config.ini', 'r');
$ini = parse_ini_file($handle, true);
but I get this error:
Warning: parse_ini_file() expects parameter 1 to be a valid path, resource given
Is this even possible? Any ideas?
fopen()
is not used like that. Try file_get_contents():This may work instead (not tested):
In either case
allow_url_fopen
needs to be enabled inphp.ini
.Fopen returns a pointer to the file, and parse_ini_file accepts file path and opens the file itself.
You should try and use file_get_contents() to get data from the file, which you then pass to parse_ini_string() function which is the same as parse_ini_file() but it takes ini file in a string.