Re: Running system commands
| From: | Robert Cummings | Date: | Tue, 23 Sep 2003 20:46:52 +0000 |
| Subject: | Re: Running system commands | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163633@lists.php.net to get a copy of this message | ||
On Tue, 2003-09-23 at 16:34, Mike Migurski wrote:
> >I was wondering, if anyone can help me with running system commands from
> >within php. Actually I have a script which deletes users from my database
> >(which is of course MySQL), now I want to delete those users from system
> >level also, as they are authenticated users of my OS also.
> >
> >Now, the problem is, that I'm running my MySQL server and web server on
> >different machines. I can do whatever on remote DB server but how to run
> >a system command on another machine. I know, it's possible to run system
> >commands on local server by system(), but what about remote server?
>
> This is partially dependent on the user your php scripts are running as.
> One approach might be to use SSH to talk to the remote machine, and set up
> a limited-privilege account there. You can run a copy of ssh-agent[1] as
> the apache user, which stores an open copy of a private SSH key in memory,
> add the public half of that key to the remote machine's authorized_keys
> file[2], and use SSH to access that machine.
Alternatively you could have a simple little PHP daemon on the webserver
and it could check a table in the remote DB every minute or so for
verbatim commands to execute. Depends really on whether these commands
need to occur real time or not.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'