The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

executing ssh in php

Discussion in 'General Discussion' started by ukgaz, Sep 1, 2008.

  1. ukgaz

    ukgaz Member

    Joined:
    Aug 18, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Currently I'm getting the error

    Code:
    
    Fatal error: Call to undefined function ssh2_connect() in /home/fps/public_html/test.php on line 6
    
    
    Which i found it is because i do not have the ssh module included in PHP.

    Can someone tell me what i need to do to be able to run the commands?
     
  2. yolau

    yolau Active Member

    Joined:
    Sep 1, 2008
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Connect to your server using ssh and run:
    Code:
    pecl install ssh2
     
  3. ukgaz

    ukgaz Member

    Joined:
    Aug 18, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    got the error

    Code:
    
    root@node7 [~]# pecl install ssh2
    Failed to download pecl/ssh2 within preferred state "stable", latest release is version 0.10, stability "beta", use "channel://pecl.php.net/ssh2-0.10" to install
    Cannot initialize 'channel://pecl.php.net/ssh2', invalid or missing package file
    Package "channel://pecl.php.net/ssh2" is not valid
    install failed
    
    
    
     
  4. yolau

    yolau Active Member

    Joined:
    Sep 1, 2008
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    It might be called "libssh2" ...
     
  5. ukgaz

    ukgaz Member

    Joined:
    Aug 18, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    nope :(

    Tried downloading the tbz from php net and installing that way, i got

    Code:
    
    root@node7 [~]# pecl install ssh2-0.10.tgz
    5 source files, building
    running: phpize
    Configuring for:
    PHP Api Version:         20041225
    Zend Module Api No:      20060613
    Zend Extension Api No:   220060519
    /usr/local/bin/phpize: /tmp/pear/cache/ssh2-0.10/build/shtool: /bin/sh: bad interpreter: Permission denied
    Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
    environment variable is set correctly and then rerun this script.
    
    ERROR: `phpize' failed
    
    
    
    I've checked and i do have correct permissions for /bin/sh and made sure that compilers are enabled within whm

    It's gonna be one of those days i think!
     
  6. SB-Nick

    SB-Nick Well-Known Member

    Joined:
    Aug 26, 2008
    Messages:
    134
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Hello,

    Disable secure tmp.
    Install the package.
    Enable secure tmp again.

    Should work.
     
  7. ukgaz

    ukgaz Member

    Joined:
    Aug 18, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    apart from editing fstab what esle way can i unsecure /tmp
     
  8. SB-Nick

    SB-Nick Well-Known Member

    Joined:
    Aug 26, 2008
    Messages:
    134
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Right way to do it is by editing /etc/fstab, changing tmp options and umount/mount the tmp with the new settings.
    Easier way to do it is 'umount /tmp' and then 'chmod 777 /tmp'.
    However, i do not recommend having a server running without securing tmp back again.
    Disabling secure tmp just for installing that package only will not cause any problems with the application in the future.
     
    #8 SB-Nick, Sep 2, 2008
    Last edited: Sep 2, 2008
Loading...

Share This Page