Jump to content

function ssh2_connect doesn't exist


Recommended Posts

We have a problem on my servers on ssh2.


My PHP program failed on :
if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");

When I do :
php -a
 $result = ssh2_connect('localhost',PORT);

=> it is running ok.

 

A short script executed with Putty :
<?php
if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");
$connection = ssh2_connect(IP, PORT);
echo "<p style='color:green;'>ssh2_connect: Ok</p>";
ssh2_auth_password($connection, 'root', PWD);
echo "<p style='color:green;'>passwd Ok</p>";
?>

=> it is running ok.

 

But the same script launched by a Browser, failed : "function ssh2_connect doesn't exist"

Is there an apache special configuration to do ? (php 7.3, ubuntu 16.04)

I have already added :

extension=php_ssh2.dll
extension=ssh2.so

In the php.ini (/etc/php/7.3/apache2/php.ini)

And restart apache service. But "function ssh2_connect doesn't exist".


Is there any other configuration to do ?

Than's for your help.

Link to post
Share on other sites
1 hour ago, yves2 said:

extension=php_ssh2.dll

Don't throw configuration at the problem unless you understand what the problem is and what the configuration can do to fix it.

You are using a Linux system. Linux does not use DLLs.

But it does use package managers. Don't edit any configuration files yourself and find the appropriate PHP + ssh package to install. Namely, php-ssh2. Installing that will do everything for you.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.