Page 1 of 1

SSHing from PHP code

Posted: Sun May 04, 2008 7:03 pm
by sprintf
please help me,

i have a php script that invokes a bash script on a remote machine via ssh. both the machines have ssh access. when i invoke the php script from the browser it doesnt get executed but when i invoke that script from command line through php interpreter it works. i dont understand why it isnt working. please help


thax

Re: SSHing from PHP code

Posted: Sun May 04, 2008 7:31 pm
by Christopher
What function does it use to "invoke" the script?

Re: SSHing from PHP code

Posted: Sun May 04, 2008 7:33 pm
by sprintf
i have tried both exec and system

Re: SSHing from PHP code

Posted: Sun May 04, 2008 10:44 pm
by Christopher
It sounds like your user account can run ssh, but the user under which the webserver runs does not. It may be that you just need to su to that account and ssh to the desired server so that ssh will create an entry for the target server.

Re: SSHing from PHP code [RESOLVED]

Posted: Mon May 05, 2008 5:58 pm
by sprintf
thanks, it WAS as you suggested, permission issue. ALL working

Re: SSHing from PHP code

Posted: Mon May 05, 2008 7:22 pm
by Chris Corbyn
There are a bunch of SSH related functions by the way ;) You'll have to install the appropriate extension for them to work however.

http://au2.php.net/manual/en/book.ssh2.php