yves2 Posted February 22, 2021 Share Posted February 22, 2021 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. Quote Link to comment https://forums.phpfreaks.com/topic/312192-function-ssh2_connect-doesnt-exist/ Share on other sites More sharing options...
requinix Posted February 22, 2021 Share Posted February 22, 2021 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. Quote Link to comment https://forums.phpfreaks.com/topic/312192-function-ssh2_connect-doesnt-exist/#findComment-1584683 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.