Jump to content

Changing a Value in a config.php


shimano55

Recommended Posts

Hey everyone. I need to know how to use php to change the value of a variable in my configuration file and resave the file with the variable having its new value. For instance, I want to change:

[code] $var1 = 1; [/code]
to
[code] $var1 = 0; [/code]

and then save the file with the new value for $var1.

Thanks,
shimano55
Link to comment
Share on other sites

[!--quoteo(post=364847:date=Apr 14 2006, 12:27 PM:name=lansing)--][div class=\'quotetop\']QUOTE(lansing @ Apr 14 2006, 12:27 PM) [snapback]364847[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I don't know if I just missed something, but what formate is the configuration file? If it is .php then just use wordpad & just save it.
[/quote]


"[b]I need to know how to use php[/b] to change the value of a variable in my configuration file"
Link to comment
Share on other sites

wildteen88 has the right answer

the php configuration file is a .ini file, you'll have to write some code to safely change the variables without messing the file up... maybe such code already exists, search google for it.

some hosts don't give you access to the ini file though.

There are also some ini values you can temporarily change (more like ignore) while the script is running. I know that's not what you wan't to do.. but just letting you know it's possible.


Edit:

Opps... I think I missunderstood what you meant by "configuration file"... are you talking about the main php ini file... or a file you've made?
Still tho.. wildteen88 has the right answer
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.