PHP extension ssh2 on internal cpanel php

speckados

Well-Known Member
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.
 

speckados

Well-Known Member
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
 

speckados

Well-Known Member
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
 

JacobPerkins

Well-Known Member
May 2, 2014
617
97
103
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
 

speckados

Well-Known Member
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
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.
 

bluehaste

Registered
Sep 10, 2015
1
0
1
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
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Thanks @bluehaste I know project phpseclib but for requiremnt of customer needs use libssh2...
Could you verify if any current issues still exist? I'm unsure if your earlier response indicated a resolution of the problem.

Thank you.