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
https://forums.phpfreaks.com/topic/7420-changing-a-value-in-a-configphp/
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"
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

Archived

This topic is now archived and is closed to further replies.

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