NYCPHP Meetup

NYPHP.org

[nycphp-talk] SSH Login via PHP

csnyder chsnyder at gmail.com
Fri Aug 11 12:08:16 EDT 2006


On 8/11/06, Ben Sgro <bens at oddcast.com> wrote:
> Hello Nick,
>
> http://us3.php.net/manual/en/ref.ssh2.php (you may need to tweak by hand for
> SSH options).
>
> It appears PHP.net has a lot of info for ssh:
> http://us3.php.net/manual/en/function.ssh2-shell.php may work for a CLI php
> app.
>
> How about letting a user upload a new .* file that is created on their
> locatal machine. Then they can login (w/ssh credentials) through the web
> based GUI, select the file from an input type=file box and use
> http://us3.php.net/manual/en/function.ssh2-scp-send.php
> to send it.
>
> There are probably a few solutions, good luck!
>
> - Ben


Following up on this, the SSH2 functions are only available if you
install the beta-grade PECL extension that contains them, and only on
unix-like systems with libssh2 (that's libssh2-dev for package
admins):

pecl install channel://pecl.php.net/ssh2-0.10

Basically, you need to know what you're doing at this point to use
them, but they work and are a good solution to the "web server needs
to write to files it shouldn't own" problem.

-- 
Chris Snyder
http://chxo.com/



More information about the talk mailing list