How to re-start a program from web interface using PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KeOu

    How to re-start a program from web interface using PHP

    Hi,

    We are running a application on the Linux, and would like to have a web
    interface to restart it remotely using PHP. I would like to get an
    advice on how to do it.

    Thanks.
    KeOu
  • Janwillem Borleffs

    #2
    Re: How to re-start a program from web interface using PHP

    KeOu wrote:[color=blue]
    > We are running a application on the Linux, and would like to have a
    > web interface to restart it remotely using PHP. I would like to get an
    > advice on how to do it.
    >[/color]

    exec
    system
    passthru
    etc.

    All in the manual.


    JW



    Comment

    • Gary L. Burnore

      #3
      Re: How to re-start a program from web interface using PHP

      On 26 Jun 2004 03:53:06 -0700, kchao@cox.net (KeOu) wrote:
      [color=blue]
      >Hi,
      >
      >We are running a application on the Linux, and would like to have a web
      >interface to restart it remotely using PHP. I would like to get an
      >advice on how to do it.[/color]

      Does the program need to run started as root? The ID you're using to
      run PHP? Important questions.

      If the program can be started by the same user running php (NOT ROOT),
      use the system("/path/to/command); syntax. Otherise:

      Create a cron job that runs regularly (like every 5 minutes). Have it
      check for the existance of a file where the php ID can write and the
      cron job can read and write. Have your php create a file (it can be
      empty) and have the cron job watch for its existance.

      If the file exists, the cron job restarts the program and removes the
      file. If the file doesn't exist, the cron job does nothing.


      --
      gburnore@databa six dot com
      ---------------------------------------------------------------------------
      How you look depends on where you go.
      ---------------------------------------------------------------------------
      Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
      | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
      DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
      | ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
      Black Helicopter Repair Svcs Division | Official Proof of Purchase
      =============== =============== =============== =============== ===============
      Want one? GET one! http://www.databasix.com
      =============== =============== =============== =============== ===============

      Comment

      Working...