Lee
Lee

Reputation: 5936

What is a good plain text configuration file format shared by PHP and Perl?

This is more of a concept question rather than a coding problem to be solved. We have a number of scripts in both PHP and Perl.

There are a large number of MySQL servers spread around the company each with a large subset of different user/permission combos.

I would like to create a central configuration file, maybe as plain text file, that has a list of all the connection data. Each language would need to be able to read the files and parse them into a usable format.

I would like to know any preferred method of implementing this.

Upvotes: 3

Views: 944

Answers (2)

Mithaldu
Mithaldu

Reputation: 2410

For PHP you have parse_ini_file and for Perl you have Config::INI::Reader. Both of these should do you pretty fine and allow structured configuration that's easily editable by humans.

Upvotes: 1

Eugene Yarmash
Eugene Yarmash

Reputation: 149776

Pick any of ini, xml, yaml or json. There are libraries for working with any of these formats in Perl and PHP.

Upvotes: 7

Related Questions