I need ssh2_sftp.
I found how to install PEAR/PECL on Opalstack.
But the ssh2
PECL extension requires libssh2
.
configure: error: The required libssh2 library was not found. You can obtain that package from http://sourceforge.net/projects/libssh2/
ERROR: `/home/XXX/tmp/pear/ssh2/configure --with-php-config=/usr/bin/php-config --with-ssh2' failed
What is the right way to install libssh2
?
✅ Answer: Already installed in /usr/lib64
.
❌ But still need to find how to tell PECL it's there.
Is it better to do php go-pear.phar
or php81 go-pear.phar
?
✅ Answer: php81
What must be done when, later, we're using a new version of PHP?
✅ Answer: pear config-set XXX
for all values including php81
.
Here's what I did to install and configure PEAR and PECL, and to (try to) install the SSH2 extension…
PHP_BIN=/usr/bin/php81
TMP_DIR=$HOME/tmp
mkdir -p $TMP_DIR && cd $_
wget http://pear.php.net/go-pear.phar
cd $HOME
$PHP_BIN $TMP_DIR/go-pear.phar
PATH=$PATH:$HOME/pear/bin
pear config-set php_bin $PHP_BIN
pear config-set temp_dir $TMP_DIR/pear
pear channel-update pear.php.net
pecl channel-update pecl.php.net
ssh2_version=$( pecl search ssh2 | grep -E "^ssh2 " | sed -E 's/^ssh2 +([0-9\.\-]+).*$/\1/g' )
pecl install ssh2-$ssh2_version