Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2007
    Location
    England
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Executing linux shell script on the webserver

    Hi,

    I have devoloped a script to append data to a text file for my linux squid proxy server. The trouble I am now having is that I want to be able to run a shell script via a web browser that will reload the squid proxy service on the same server.

    The shell script has the command to reload the squid proxy service using the following commands:

    echo Reloading External Lists Please Wait...
    service squid reload
    echo Reload Complete
    echo Proxy Ready

    Is there any way to call this script and execute the shell script through PHP or is there a more suitable way, such as commands like system or exec??

    Many Thanks,

    BlackFish

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,093
    Thanks
    11
    Thanked 101 Times in 99 Posts
    more suitable would be a CRON job where you can run the script as root or whoever you wish.

    assuming that you need to give the script elevated privileges then that means either running the webserver as a privileged user (not recommended) or adding PHP to sudoers or some SUID solution .. all messy
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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