Jump to content

Config File


TashaAT

Recommended Posts

I have an application that needs me to go and put the DB settings manually.

Can I do this?

Write a config file like this:

define('DB_SERVER', '');

  define('DB_SERVER_USERNAME', '');

  define('DB_SERVER_PASSWORD', '');

  define('DB_DATABASE', '');

  define('USE_PCONNECT', 'false');

  define('STORE_SESSIONS', '');

 

Put the information in and on every page put this:

require('configure.php');

 

And is there an easier / better way to do it?

Link to comment
https://forums.phpfreaks.com/topic/113927-config-file/
Share on other sites

yes or to save constants you can do an array

 

$databaseInfo = array(
  "host"  =>  "localhost",
  "user"  =>  "myuser",
  "pass" =>  "password",
  "db"  =>  "database",
  "pconn"  =>  false,
  "store_sess"  =>  ""
);

 

Then add an include 'config.php'; to each page and just use this where needed

$databaseInfo["host"], etc.

Link to comment
https://forums.phpfreaks.com/topic/113927-config-file/#findComment-585520
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.