XMen
XMen

Reputation: 30238

creating configuration file in php

i want to create the configuration file , which will have the application id and update path two variable , when i will pass the application id in the api it will return the update path of that application id . how i will achieve this making of configuration file.

regards

rahul

Upvotes: 0

Views: 10353

Answers (3)

rabi shankar shaw
rabi shankar shaw

Reputation: 11

<?php

if ( ! defined('EXT')){
exit('Invalid file request');
}

$conf['app_version'] = "167";
$conf['license_number'] = "";
$conf['debug'] = "1";
$conf['install_lock'] = "1";
$conf['db_hostname'] = "localhost";
$conf['db_username'] = "username";
$conf['db_password'] = "password";
$conf['db_name'] = "sample";
$conf['db_type'] = "mysql";
$conf['db_prefix'] = "exp";
$conf['db_conntype'] = "0";
$conf['system_folder'] = "system";
$conf['cp_url'] = "http://sample:8888/system/index.php";
$conf['doc_url'] = "http://expressionengine.com/docs/";
$conf['cookie_prefix'] = "";
$conf['is_system_on'] = "y";
$conf['allow_extensions'] = "n";
$conf['multiple_sites_enabled'] = "n";
?>

Upvotes: 1

XMen
XMen

Reputation: 30238

i have done it by making an array

    $config = array (
        "{b0ff543d-d294-42c8-83eb-d72161ec6771}"  => '/var/www/youngib/rahul/'
    );
$source=$config[$_REQUEST['applicationid']];

thanks

rahul

Upvotes: 0

Gaurav Jassal
Gaurav Jassal

Reputation: 912

You can create an INI configuration file for your project and the parse it using php parse_ini_file function.

http://php.net/manual/en/function.parse-ini-file.php

Sample INI file

; This is a sample configuration file
; Comments start with ';', as in php.ini

[first_section]
one = 1
five = 5
animal = BIRD

[second_section]
path = "/usr/local/bin"
URL = "http://www.example.com/~username"

[third_section]
phpversion[] = "5.0"
phpversion[] = "5.1"
phpversion[] = "5.2"
phpversion[] = "5.3"

Here is another example for PHP configuration patterns

h++p://www.ibm.com/developerworks/library/os-php-config/index.html

Upvotes: 3

Related Questions