Php refuses to find ssh2_connect () function

Operating system used

Windows 7 - V 6.1

Apache installed

httpd-2.2.22-win32-x86-no_ssl.msi

My httpd.conf

AddType application/x-httpd-php .php

LoadModule php5_module "X:/Program Files/PHP/php5apache2_2.dll"

Version installed php

php-5.3.16-Win32-VC9-x86.msi

I copied php_ssh2.dll from php_ssh2-0.11.2-5.3-nts-vc9-x86.zip uncompressed

php_ssh2-0.11.2-5.3-nts-vc9-x86.zip

to

X:\Program Files\PHP\ext\php_ssh2.dll

My php.ini

extension_dir="X:\Program Files\PHP\ext"

PHPIniDir "X:/Program Files/PHP"

[PHP_SSH2]
extension=php_ssh2.dll

Apache was restarted after setting php.ini using php_ssh2.dll and after copying the php_ssh2.dll file to extension_dir - the error persists

Fatal error: Call to undefined function ssh2_connect() in X:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php on line 4

code used for testing

<?php
$connection = ssh2_connect("XXX.XXX.XXX.XXX", 22);

if(ssh2_auth_password($connection, "XXXXXX", "XXXXXX"))
  printf("CONNECTED");
else
  printf("ERROR");
?>

The test with phpinfo () displays the page perfectly in the browser because php was configured using httpd.conf, but the extension_dir parameter is displayed as

extension_dir C:\php C:\php

but this parameter was set to "X: \ Program Files \ PHP \ ext"

+5
source share
5 answers

ini ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp Registered PHP Streams, dll . Apache ?

,

PHPIniDir "X:/Program Files/PHP"

in httpd.conf not php.ini

+1

.DLL php.ini( conf, ), PHP: extension=ssh2.dll ( ;, )

, SSH2 PHP Windows ( apache): php -m php, ssh2.

ssh2_connect()

+3

.

, ssh2:

sudo apt-get install libssh2-php

, , ssh2

php -r "print_r(get_loaded_extensions());"

public function movefolder() {



          $connection = ssh2_connect('xxx.xx.xx.xx', 22);

        $res = ssh2_auth_password($connection, 'xxxx', 'xxxx123');


          $res1 = ssh2_scp_send ($connection, '/home/user/public/upgrades/downloaded/abc.tar', '/home/xxx/public/abc.tar', 0644);


           echo $connection . '--' . $res. '--' .$res1;

        die;

    }
+1
  • php_ssh2-0.11.2-5.3-vc9-x86.zip
  • php.ini
  • Wamp

Wamp Apache 5.3 W32

0

php_ssh2-0.11.2-5.3-nts-vc9-x86.zip 2 dlls

  • php_ssh2.dll
  • libssh2.dll

the first transition here is
X: \ Program Files \ PHP \ ext \ php_ssh2.dll and the second there X: \ Program Files \ PHP \ libssh2.dll

0
source

All Articles