2

How can I change values of the .ini files via command line? (linux or windows)

For example I have a php.ini file:

display_errors = On
error_reporting = E_ALL & ~E_NOTICE

Now, I need be like this command:

MAGIC-COMMAND display_errors=Off error_reporting=E_ALL php.ini

And that options effective and write in php.ini file, and I have this content:

display_errors = Off
error_reporting = E_ALL
Nabi K.A.Z.
  • 420
  • 1
  • 6
  • 11
  • 3
    What have *you* tried? `sed -i` looks like a good start. – Kamil Maciorowski Aug 15 '18 at 16:53
  • How about `vi php.ini` and then edit from Linux command line accordingly with vi? Are you trying to just get a method to edit in the command line or do you need to automate the task with a script or some command you can just run over and over? – Vomit IT - Chunky Mess Style Aug 16 '18 at 03:21
  • @KamilMaciorowski, I don't need a find and replace software, I need to a smart setter and getter. be like this for parse: https://github.com/rudimeier/bash_ini_parser – Nabi K.A.Z. Aug 16 '18 at 05:46
  • @PimpJuiceIT see latest comment. – Nabi K.A.Z. Aug 16 '18 at 05:47
  • "I need to a smart setter and getter" -- Is your question asking for software recommendation then? (which would be off-topic here, so think twice). `sed` is perfectly capable of doing the changes your question describes. If you need something "smart" then please [edit] the question and explain your requirements. All this aside, my point was your question doesn't show your research effort. It's like "write a script for me" (off-topic, we're not a script writing service; we can help you with your *existing* script though) or "find a software for me" (off-topic). See [ask]. – Kamil Maciorowski Aug 16 '18 at 06:00

0 Answers0