Jump to content

parse_ini_file() error


tbobker

Recommended Posts

UPDATE: Typical, as soon as a posted this message I solved it. For some reason php doesnt like my on=1. I changed this to status=on and all is good.

 

 

 

I have a ini file called settings.ini it contains the following:

 

[system]
on=1

 

The idea is that I update this ini file to turn the application on or off, 1 being on.

 

When I use parse_ini_file("settings.ini") I receive this error

Warning: Error parsing settings.ini on line 2 in

 

The PHP calling this is:

 

$ini = parse_ini_file("settings.ini");

 

What is wrong with this and is using a ini file the way to go. I thought its a bit much having it in a database its just a flag to tell the application if the system can run or not.

 

Any help appreciated.

I just cant see what the issue is.

Link to comment
Share on other sites

Just for clarification, here is a note from the parse_ini_file() manual page:

 

Note: There are reserved words which must not be used as keys for ini files. These include: null, yes, no, true, false, on, off, none. Values null, no and false results in "", yes and true results in "1". Characters ?{}|&~![()^" must not be used anywhere in the key and have a special meaning in the value.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.