Questions tagged [ini]

The INI file format includes text-based initialization information for programs. Its structure is composed of "sections" and "properties".

INI is a file format for saving configurations. They are basic text files with a specified format. An INI file contains key/value pairs, which are divided into sections. For example, an INI file for a mobile phone OS could look like this.

[graphics]
login_screen=mountains
desktop_back=earth_from_space
look_and_feel=classic_layout

[securite]
enable_password = true
;should a password be required to unlock the phone
password_on_unlock = true 
password = AC4d201cxDAc30F5AC4d201cxDAc30F5

A section name is put between square brackets. Each line after the section title contains a key/value pair, separated by an equals sign (=). Lines starting with a semicolon are comments.

The INI file format is not well defined, many implementations handle INI files differently. Some ignore whitespaces in key or value names, while some don't. Some implementations allow for the number sign (#) for comments, while some others don't.

1656 questions
19
votes
6 answers

PowerShell to Read single value from simple .ini file

Everything I've found looks way over complex. It's almost like I just need to read a text file. ADAP.ini contains this, nothing else: http://xxx.104.xxx.226 APP=2.3.6 DLL=2.3.6 Using Powershell, how can I read what APP=value is? and or what…
JustJohn
  • 1,362
  • 2
  • 22
  • 44
19
votes
5 answers

PHP parse_ini_file() performance?

I know some people store settings in an .ini file and get the values with parse_ini_file() in PHP. Without running tests, I am curious about performance. Do you know if opcode cache can cache any of this type of stuff if setting are in an ini file?
JasonDavis
  • 48,204
  • 100
  • 318
  • 537
17
votes
4 answers

my_config.ini vs my_config.php

At work we use a .ini file to set variables prior to calling the rest of the framework (I think it goes function getConfigVars(){ //read my_config.ini file .... //call framework } and I have always wondered if there was a benefit to…
SeanJA
  • 10,234
  • 5
  • 32
  • 42
17
votes
2 answers

How to enable uWSGI logging to a file?

I have just installed my first uWSGI server on EC2 Ubuntu 14.04 LTS, using the following configuration: [uwsgi] http-socket = :9001 plugin = python wsgi-file = foo.wsgi chdir = /home/bar process = 3 The uWSGI container works fine, but has…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
16
votes
5 answers

Read all ini file values with GetPrivateProfileString

I need a way to read all sections/keys of ini file in a StringBuilder variable: [DllImport("kernel32.dll")] private static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int…
leon22
  • 5,280
  • 19
  • 62
  • 100
16
votes
3 answers

How to correctly use `.user.ini`-file in PHP?

In my working directory I have two files: index.php and .user.ini: .user.ini: display_errors=on ; http://be2.php.net/manual/en/filter.configuration.php#ini.filter.default ;filter.default =…
Edward
  • 4,453
  • 8
  • 44
  • 82
15
votes
1 answer

Pyramid and .ini configuration

Each Pyramid application has an associated .ini file that contains its settings. For example, a default might look like: [app:main] use = egg:MyProject pyramid.reload_templates = true pyramid.debug_authorization = false pyramid.debug_notfound =…
evgeny
  • 2,564
  • 17
  • 27
15
votes
2 answers

Syntax error using parse_ini_file() when file's value's contain exclamation points and equal signs

The function below takes the "test-backup.ini" file, parses it and inputs the values into the DB via the update_option() method. However, when the ini file's values contain special characters like exlamation points (!) and equal signs (=) (and…
Scott B
  • 38,833
  • 65
  • 160
  • 266
15
votes
3 answers

Python config parser that supports section inheritance?

I'm looking for an ini style config parser in Python that supports section inheritance similar to what Zend_Config_Ini does in PHP. Does such a module exist or will I need to roll my own?
Maascamp
  • 348
  • 1
  • 3
  • 8
15
votes
2 answers

PHP: Escape illegal chars in .ini-files

The documentation on parse_ini_file states that you can't use these chars {}|&~![()^" in the value. Is there some way to escape these chars? I need to use them. Normal escaping with \ doesn't seem to work.
Martin
  • 5,197
  • 11
  • 45
  • 60
15
votes
7 answers

How can I access INI files from Perl?

What is the best way to parse INI file in Perl and convert it to hash?
dan
  • 885
  • 2
  • 9
  • 18
15
votes
3 answers

how can i get the ini data in pyramid?

There is a development.ini or production.ini in a pyramid project. I add my own config data in the ini files like: [thrift] host = 0.0.0.0 port = 8080 and I want to use the config data in one of py files in the project. How can I get the data…
Tallmad
  • 1,951
  • 4
  • 22
  • 29
14
votes
3 answers

Round-trip parsing of data structure format (YAML or whatnot) preserving comments, for writing configuration

I have been using YAML as configuration file format in several applications, and all went well except one thing: when my program needs to write/modify a config variable in a YAML config file, it destroys formatting and comments by loading and…
Steven Haryanto
  • 741
  • 5
  • 13
13
votes
4 answers

Parsing an "advanced" INI file with PHP

Basically, I would like a simple, easy, one-file way to parse an INI file with "advanced" features, like section inheritance and property nesting, like Zend_Config_Ini. For example: [foo] a = 1 b.a = 2 b.b = 3 b.c = 4 c = 5 [bar : foo] b.b = 17 c =…
Austin Hyde
  • 26,347
  • 28
  • 96
  • 129
13
votes
5 answers

MySQL: my.ini not read

I have MySQL 5.6 installed on Windows 7 64 Bit and I can't seem to get it to read my my.ini file. I've put the file into the base installation directory, the Windows directory and C:\, but it doesn't look like it's being read, even though all paths…
Alex
  • 1,198
  • 2
  • 12
  • 26