Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Changing INI entries in a script

    Hi All,

    i'm a newbie...
    how do i change an entry in INI files ?

    something like this:


    changeinietnry /etc/php.ini register_globals=On

    Thank you all!

  2. #2
    Linux Guru
    Join Date
    Apr 2003
    London, UK
    There is no easy way AFAIK to do that in a shell script (i may be wrong).

    What programming languages do you know? It should be possible to do it in PHP or C. Read the file into memory, write it out a line at a time, when you get to the "register globals" line, instead of writing the line from memory, write the line you want to go there instead.


  3. #3
    Linux Engineer
    Join Date
    Apr 2003
    Read up on awk... that can read and write in the changes you want....

    man awk


  4. $spacer_open
  5. #4
    Quote Originally Posted by andutt
    Read up on awk... that can read and write in the changes you want....
    i think, modifying a php.ini in a php script is not the best idea,
    buti'm a newbie in linux - may be i'm wrong.
    The reason is - i d'like to write a kind of setup program under linux.
    So PHP is perhaps not installed in the moment of setup calling

    so i would prefer a shell command / small script
    (perl os something like this)

    well - awk seems to be a powerfull tool, i'll try it out - thank you all.


    P.S. A Question: would you generate a VirtualHost Entry in httpd.conf
    with awk too ?
    The reason is the same - i'd like to write a script, that automatically
    set up a server and a couple of websites ????

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts