Find the answer to your Linux question:
Results 1 to 3 of 3
Hello all, I'm busy with Squid and it works great But what I wanna do is to change the Squid http_access through a php form This form will be accessed ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! GatekeeperCruelman's Avatar
    Join Date
    Nov 2008
    Location
    The Netherlands, Wilbertoord
    Posts
    20

    How to edit squid.conf with a script?


    Hello all,

    I'm busy with Squid and it works great
    But what I wanna do is to change the Squid http_access through a php form
    This form will be accessed through a webbrowser.
    With other words: how can I write some information in the middle of a file.
    I prefer perl, C and php to write the script with.

    Thanks in advanced.

  2. #2
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,429
    This is not hard at all.
    There are numerous ways to do it.
    I think that the easiest is.

    Read the file to the memory.
    Split the file in two segments.
    Segment_One -> Everything before what you want to edit.
    Segment_Two -> Everything after what you want to edit.

    Rewrite the file:
    Write -> Segment_One
    Write -> New_Text
    Write -> Segment_Two

    Hope that helps.

    ps. if it doesn't, I can supply code snippers.
    New Users, please read this..
    Google first, then ask..

  3. #3
    Just Joined! GatekeeperCruelman's Avatar
    Join Date
    Nov 2008
    Location
    The Netherlands, Wilbertoord
    Posts
    20
    Thanks for the reply.
    What I did was making two files (a top and a bottom).
    With php I'm creating the rules I want and write it to the squid.conf

    Code snipper sounds interesting.
    Don't know how you want to send it to me?

  4. $spacer_open
    $spacer_close

Posting Permissions

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