简体   繁体   中英

Connecting via SSH from a PHP script

I am getting this error when trying to connect to a server via SSH from a PHP script. "Fatal error: Call to undefined function ssh2_connect()".

I checked my PHPINFO() and it shows libSSH Version = libssh2/1.4.2 but when I look in \\php\\ext I do not see php_ssh2.dll. Also, I don't have show anything in my php.ini file about ssh.

I am very new to SSH and would love some advice on how to get this working. I currently using XAMPP on a window machine for testing and I have a home server that I am trying to connect via SSH to. I know that SSH is working and configured on the server because I am able to connect just fine using Putty.exe. Thanks in advance for any advice.

The PHP ssh2 extension is not built for Windows .

You can try compiling it yourself, but that's probably a lot more work than you really want to put into this. Probably best to just use a Linux system for developing your project, where installing and using this extension is fairly trivial.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM