Re: [PHP] SSH and php
From: David T-G (davidtg-php_at_justpickone.org)
Date: Mon, 17 Nov 2003 11:21:29 -0500 To: PHP General list <firstname.lastname@example.org>
...and then Ryan A said...
% Hey David,
% % Is it possible to run a SSH command from php?
% >Sure; it's possible to run any command from php. It may not work all
% >that well, though :-)
% heheh, good one. As helpful as usual :-D
Always there for ya, man :-)
% >Good enough. What do you want to do?
% Basically stop/restart apache when i make changes to the httpd.conf file.
There are ways to do that -- I personally would create a kick script
outside of the htdocs tree, give the apache user permission to run that,
and call that script from an https page with some authentication -- but
you always have to fall back to "if that script fails, then I need to log
in and use the shell" anyway.
% But then thinking of it I realize that if I stop apache from a script, once
% apache is stopped
% I cant run any php to restart it...right?
You certainly can't run any php web script :-)
% So I guess my question gets cut down to basically "any good place/program to
% learn/use SSH?"
As you've been shown, ssh is nothing magical; what you want to do is
learn how to use a *NIX shell. Think DOS command prompt. If you can
already use a command prompt, then try an ssh in and look around (ls,
chdir, pwd, ...).
HTH & HAND
-- David T-G * There is too much animal courage in (play) email@example.com * society and not sufficient moral courage. (work) firstname.lastname@example.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
- application/pgp-signature attachment: stored