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.

1553 questions
47
votes
4 answers

browscap ini directive not set

I'm using the get_browser() function in an attempt to warn people that their browser doesn't support Javascript. Actually I'm using it to tell them they can use certain parts of a web application I'm building. I've decided to properly use Javascript…
Robert Hurst
  • 8,017
  • 5
  • 36
  • 63
44
votes
8 answers

PHP ini file_get_contents external url

I use following PHP function: file_get_contents('http://example.com'); Whenever I do this on a certain server, the result is empty. When I do it anywhere else, the result is whatever the page's content may be. When I however, on the server where the…
arik
  • 23,480
  • 35
  • 91
  • 147
44
votes
6 answers

create ini file, write values in PHP

I cannot find a way that easily lets me create a new file, treat it as an ini file (not php.ini or simiilar... a separate ini file for per user), and create/delete values using PHP. PHP seems to offer no easy way to create an ini file and…
netrox
  • 5,085
  • 12
  • 41
  • 58
39
votes
8 answers

Script timeout passed, if you want to finish import, please resubmit the same file and import will resume

I have a database Un-zipped size 50mb zipped size 7mb So when I try to import the database zipped(7mb) after few minutes it is throwing this error: Script timeout passed, if you want to finish import, please resubmit the same file and import…
Mr world wide
  • 3,879
  • 6
  • 34
  • 77
35
votes
3 answers

Is it possible to use inline comments for .ini files with PHP?

Is it possible and safe to use inline comments for .ini files with PHP? I prefer a system where the comments are inline with the variables, coming after them. Are the some gotchas concerning the syntax to be used?
vfclists
31
votes
7 answers

How to read and write to an ini file with PHP

I've been looking around the official php documentation but I'm unable to find what I'm looking for. http://php.net/manual/en/function.parse-ini-file.php I just want a function to edit and read the value from the php ini file, for…
Joricam
  • 2,049
  • 4
  • 17
  • 14
31
votes
9 answers

QSettings - where is the location of the ini file?

I'm using QSettings to store some data as ini file in Windows. I want to see the ini file, but I don't know what is the location of the ini file. This is my code: QSettings *set = new QSettings(QSettings::IniFormat, QSettings::UserScope, "bbb",…
dubila
  • 819
  • 2
  • 8
  • 11
29
votes
6 answers

Windows batch script to read an .ini file

I'm trying to read an .ini file with the following format: [SectionName] total=4 [AnotherSectionName] total=7 [OtherSectionName] total=12 Basically I want to print out certain values from the .ini file, for example the total under OtherSectionName…
Hintswen
  • 3,847
  • 12
  • 36
  • 45
27
votes
2 answers

.ini file load environment variable

I am using Alembic for migrations implementation in a Flask project. There is a alembic.ini file where the database configs must be specified: sqlalchemy.url = driver://user:password@host/dbname Is there a way to specify the parameters from the…
dimmg
  • 2,156
  • 1
  • 15
  • 27
25
votes
8 answers

Read all the contents in ini file into dictionary with Python

Normally, I code as follows for getting a particular item in a variable as follows try: config = ConfigParser.ConfigParser() config.read(self.iniPathName) except ConfigParser.MissingSectionHeaderError, e: raise…
prosseek
  • 155,475
  • 189
  • 518
  • 818
25
votes
2 answers

How to set boolean values in an INI configuration file?

I've seen a variety of ways used to set boolean values in INI files: variable = true variable = 1 variable = on variable = yes Which is the most canonical, common, and/or preferred way?
Anirvan
  • 5,895
  • 5
  • 36
  • 53
23
votes
4 answers

Update INI file without removing comments

Consider the following INI file: [TestSettings] # First comment goes here environment = test [Browser] # Second comment goes here browser = chrome chromedriver = default ... I'm using Python 2.7 to update the ini file: config =…
sarbo
  • 1,501
  • 4
  • 19
  • 22
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
  • 45,100
  • 92
  • 294
  • 508
16
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
  • 9,518
  • 5
  • 30
  • 42
16
votes
3 answers

Change value in ini file using ConfigParser Python

So, I have this settings.ini : [SETTINGS] value = 1 And this python script from ConfigParser import SafeConfigParser parser = SafeConfigParser() parser.read('settings.ini') print parser.get('SETTINGS', 'value') As you can see, I want to read…
Giggle
  • 369
  • 1
  • 3
  • 14