Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All, i'm a newbie... how do i change an entry in INI files ? something like this: #!/bin/sh changeinietnry /etc/php.ini register_globals=On Thank you all! Alex....
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2004
    Posts
    3

    Changing INI entries in a script


    Hi All,

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

    something like this:

    #!/bin/sh

    changeinietnry /etc/php.ini register_globals=On

    Thank you all!
    Alex.

  2. #2
    Linux Guru
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    3,284
    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.

    Jason

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

    Code:
    man awk
    Regards

    Andutt

  4. #4
    Just Joined!
    Join Date
    Feb 2004
    Posts
    3
    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.

    Alex.

    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
  •