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.

PHP extension ssh2 on internal cpanel php

Discussion in 'General Discussion' started by speckados, Sep 9, 2015.

  1. speckados

    speckados Well-Known Member

    Joined:
    May 21, 2003
    Messages:
    291
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Acequias :: Granada :: España
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Hi.

    I need use ssh2 extension on internal php (/usr/local/cpanel/3rdparty/bin/php) for a addon & plugin.

    I don't like force install a parallel php for use with my app.

    It's possible ?

    The're any request for this on Cpanel?

    Apreciate help.
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    According to the documentation (http://php.net/manual/en/ssh2.installation.php) ssh2 is a pecl module. You should be able to install it by executing /usr/local/cpanel/3rdparty/bin/pecl. You'll likely need to install the libss2 dependency if that is not already on the system.
     
  3. speckados

    speckados Well-Known Member

    Joined:
    May 21, 2003
    Messages:
    291
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Acequias :: Granada :: España
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Well.

    I know this.

    But I don't know how to install on cpanel php ssh2

    Code:
    # /usr/local/cpanel/3rdparty/bin/php -i |grep ssh
    CVS_RSH => ssh
    _SERVER["CVS_RSH"] => ssh
    _ENV["CVS_RSH"] => ssh
    # php -i |grep ssh
    Registered PHP Streams => compress.zlib, compress.bzip2, dict, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp, php, file, glob, data, zip, phar, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp
    ssh2
    libssh2 version => 1.4.4-20150125
    banner => SSH-2.0-libssh2_1.4.4-20150125
    CVS_RSH => ssh
    _SERVER["CVS_RSH"] => ssh
    _ENV["CVS_RSH"] => ssh
    
     
  4. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    509
    Likes Received:
    65
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Hi,

    As Ken suggested, you'll need to use the binary located at '/usr/local/cpanel/3rdparty/bin/pecl' to install this to cPanels internal PHP
     
  5. speckados

    speckados Well-Known Member

    Joined:
    May 21, 2003
    Messages:
    291
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Acequias :: Granada :: España
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Error...
    Code:
    /usr/local/cpanel/3rdparty/bin/pecl  install channel://pecl.php.net/ssh2-0.12
    downloading ssh2-0.12.tgz ...
    Starting to download ssh2-0.12.tgz (26,223 bytes)
    .........done: 26,223 bytes
    6 source files, building
    running: phpize
    Configuring for:
    PHP Api Version:  20100412
    Zend Module Api No:  20100525
    Zend Extension Api No:  220100525
    /usr/local/cpanel/3rdparty/php/54/bin/phpize: /tmp/pear/temp/ssh2/build/shtool: /bin/sh: bad interpreter: Permiso denegado
    Cannot find autoconf. Please check your autoconf installation and the
    $PHP_AUTOCONF environment variable. Then, rerun this script.
    
    ERROR: `phpize' failed
    
    Also
    Code:
    /usr/local/cpanel/3rdparty/bin/pecl  install ssh2
    Failed to download pecl/ssh2 within preferred state "stable", latest release is version 0.12, stability "beta", use "channel://pecl.php.net/ssh2-0.12" to install
    install failed

    Also
    Code:
    /usr/local/cpanel/3rdparty/bin/pecl  install ssh2-beta
    downloading ssh2-0.12.tgz ...
    Starting to download ssh2-0.12.tgz (26,223 bytes)
    .........done: 26,223 bytes
    6 source files, building
    running: phpize
    Configuring for:
    PHP Api Version:  20100412
    Zend Module Api No:  20100525
    Zend Extension Api No:  220100525
    /usr/local/cpanel/3rdparty/php/54/bin/phpize: /tmp/pear/temp/ssh2/build/shtool: /bin/sh: bad interpreter: Permiso denegado
    Cannot find autoconf. Please check your autoconf installation and the
    $PHP_AUTOCONF environment variable. Then, rerun this script.
    
    ERROR: `phpize' failed
    
     
  6. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    509
    Likes Received:
    65
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Hi,
    Does /bin/sh have bad permissions? It says 'Permission denied' when it tries to execute that script.
    I was able to install this without any issues.

    Code:
    Build process completed successfully
    Installing '/usr/local/cpanel/3rdparty/php/54/lib/extensions/no-debug-non-zts-20100525/ssh2.so'
    install ok: channel://pecl.php.net/ssh2-0.12
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=ssh2.so" to php.ini
    
     
  7. speckados

    speckados Well-Known Member

    Joined:
    May 21, 2003
    Messages:
    291
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Acequias :: Granada :: España
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Code:
    /bin/sh: bad interpreter: Permiso denegado
    Code:
     [~]# ls -lisa /bin/sh
    5790148 0 lrwxrwxrwx 1 root root 4 sep 30  2014 /bin/sh -> bash*
    [~]# ls -lisa /bin/bash
    5790054 756 -rwxr-xr-x 1 root root 768952 sep 26  2014 /bin/bash*
    
    This indicates that the error is not in the file permissions.
    It could be an error in the file is called, but when I write this post is to encourage someone Cpanel team sees it and can bring light, not to make me the research.


    But for that matter, I had to investigate.
    As it is not a sh porblema, there was only the execution path /tmp

    Above not problem... /tmp correct permissions
    Code:
    [~]#cat /etc/fstab| grep tmp
    LABEL=/tmp  /tmp  ext4  defaults  1 2
    tmpfs  /dev/shm  tmpfs  defaults  0 0
    /tmp  /var/tmp  ext3  defaults,bind,noauto  0 0
    tmpfs /var/mysqltmp tmpfs rw,gid=101,uid=100,size=512M,nr_inodes=10k,mode=0700 0 0
    
    Above problem... noexec on mounted /tmp
    Code:
    [~]#cat /etc/mtab| grep tmp
    /tmp /var/tmp none rw,noexec,nosuid,bind 0 0
    
    I don't like expend more time, and workround with create a symbolic link to /root/pear on /tmp/pear.

    Apreciate your time.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    If I am understanding correctly, you were able to address the issue by adjusting the mount options on your /tmp partition. Is that correct?

    Thank you.
     
  9. bluehaste

    bluehaste Registered

    Joined:
    Sep 10, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Houston, TX
    cPanel Access Level:
    Website Owner
    You could use phpseclib to emulate the libssh2 functions without having to install libssh2:

    github.com/phpseclib/libssh2-compatibility-layer
     
    #9 bluehaste, Sep 10, 2015
    Last edited by a moderator: Sep 10, 2015
  10. speckados

    speckados Well-Known Member

    Joined:
    May 21, 2003
    Messages:
    291
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Acequias :: Granada :: España
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Thanks @bluehaste I know project phpseclib but for requiremnt of customer needs use libssh2...
     
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Could you verify if any current issues still exist? I'm unsure if your earlier response indicated a resolution of the problem.

    Thank you.
     
Loading...

Share This Page