Joseph U.
Joseph U.

Reputation: 4607

What is the best way to get a configuration variable in PHP

Each server (Dev, QA, Prod) has a different IP address and URL. I would like to write code so that it can pull that information (the URL for the particular server I am running the code on) from a configuration file and store it in a variable.

Preferably I would like to avoid having to read the information from a file on subsequent requests since the information should not be changing often.

What is the best way to accomplish this?

Upvotes: 1

Views: 75

Answers (1)

Etienne Marais
Etienne Marais

Reputation: 1690

Use the $_SERVER array to get the current server details

http://php.net/manual/en/reserved.variables.server.php

Upvotes: 3

Related Questions