470,833 Members | 1,203 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

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
Jul 17 '05 #1
2 1803
KeOu wrote:
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.


exec
system
passthru
etc.

All in the manual.
JW

Jul 17 '05 #2
On 26 Jun 2004 03:53:06 -0700, kc***@cox.net (KeOu) wrote:
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.


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@databasix 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
================================================== =========================
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Craig Bailey | last post: by
11 posts views Thread by James | last post: by
1 post views Thread by John Ryan | last post: by
8 posts views Thread by Beowulf | last post: by
1 post views Thread by joost | last post: by
1 post views Thread by Clarice Almeida Hughes | last post: by
2 posts views Thread by JW | last post: by
4 posts views Thread by Zachary Antolak | last post: by
2 posts views Thread by Frans Schmidt | last post: by
2 posts views Thread by sky2070 | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.