From: Le-shin Wu on 24 Mar 2010 16:58 I can successfully create a ssh connection within a index.php file by using ssh2_connect(). But when I try to create a web service by using the same code, I got "Unable to connect to a.b.c.d (IP address) on port 22" error. In other words, if I run the command "php index.php" under shell prompt, it works perfectly; but if I request the same file through my Web browser ( http://mydomain/index.php), I got an unable to connect error. Is there someone having any idea about that. Thanks a lot for your help. (REHL 5 with PHP 5.1.6)
From: vikash.iitb on 24 Mar 2010 17:16 It may be a permission problem. When you try "php index.php", then its 'your-username' is trying to SSH. But when you run the script through webserver, the user 'apache' is trying to SSH. Can you just check this once. Thanks, Vikash Kumar -- http://vika.sh On Thu, Mar 25, 2010 at 2:28 AM, Le-shin Wu <leshin(a)gmail.com> wrote: > I can successfully create a ssh connection within a index.php file by using > ssh2_connect(). But when I try to create a web service by using the same > code, I got "Unable to connect to a.b.c.d (IP address) on port 22" error. > In > other words, if I run the command "php index.php" under shell prompt, it > works perfectly; but if I request the same file through my Web browser ( > http://mydomain/index.php), I got an unable to connect error. Is there > someone having any idea about that. Thanks a lot for your help. (REHL 5 > with > PHP 5.1.6) >
From: Le-shin Wu on 24 Mar 2010 21:57 Thanks a lot for your advise. In fact, I thought about that as well, but I do not know how to switch the user from apache to a real user when I send a request through Web browser. I even tried to use "ssh_rsa" method instead of password authentication. But I got the same error. Command line fine, but through web server I got an error in the first place (ssh2_connect). I am wondering do you have any suggestion. Thanks a lot. Best Le-Shin On Wed, Mar 24, 2010 at 5:16 PM, <vikash.iitb(a)gmail.com> wrote: > It may be a permission problem. > > When you try "php index.php", then its 'your-username' is trying to SSH. > But when you run the script through webserver, the user 'apache' is trying > to SSH. > > Can you just check this once. > > Thanks, > Vikash Kumar > -- > http://vika.sh > > > > On Thu, Mar 25, 2010 at 2:28 AM, Le-shin Wu <leshin(a)gmail.com> wrote: > >> I can successfully create a ssh connection within a index.php file by >> using >> ssh2_connect(). But when I try to create a web service by using the same >> code, I got "Unable to connect to a.b.c.d (IP address) on port 22" error. >> In >> other words, if I run the command "php index.php" under shell prompt, it >> works perfectly; but if I request the same file through my Web browser ( >> http://mydomain/index.php), I got an unable to connect error. Is there >> someone having any idea about that. Thanks a lot for your help. (REHL 5 >> with >> PHP 5.1.6) >> > >
|
Pages: 1 Prev: Bitly-PHP - A PHP Bitly API to shorten URLs, expand and more. Next: Top vs. Bottom Posting. |