CyberHosting

How to install "ssh2" php extension

Hello everyone, i am trying to run my old source code (from httpd webserver), i have a problem, 1 module - "php-ssh2" didn't installed. I had try to install by manual way:
install libssh2
install ssh2 from pecl and got ssh2.so in /usr/lib64/php/modules
then i copy it to /usr/local/lsws/lsphp72/lib64/php/modules/ssh2.so and add to files /usr/local/lsws/lsphp72/etc/php.ini this line
"ssh2_extension = /usr/local/lsws/lsphp72/lib64/php/modules/ssh2.so"
but i doesn't work, can anyone help me ?

Comments

  • Bump. Trying this myself and it's not showing up in my phpinfo. @CyberPanel, any advice on this one?
  • edited February 14
    Found the answer! Here's the trick. If you look at the official package for ssh2 for PHP, the extension is supposed to be loaded after other specific PHP extensions and before other ones. If you download the package here and extract it...

    https://centos.pkgs.org/6/remi-testing-x86_64/php-pecl-ssh2-0.13-2.el6.remi.5.6.x86_64.rpm.html

    ... that means you should add the file "40-ssh2.ini" to your folder "/usr/local/lsws/lsphp74/etc/php.d/" with the following contents:

    > ; Enable ssh2 extension module
    > extension=ssh2.so

    So, to answer this, no, you cannot simply add "ssh2_extension = /usr/local/lsws/lsphp72/lib64/php/modules/ssh2.so" to php.ini since it has to be loaded in a very particular order. By adding the following file above to your php.d folder, then the ssh2 extension, from being in the proper order, will load successfully. Hope this helps!
Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion