Home > Article > Backend Development > How do I fix the \'Fatal error: Call to undefined function ssh2_connect()\' error when installing SSH2 on Windows?
Installing SSH2 for PHP on Windows
When attempting to install SSH2 on a Windows machine running Apache, you may encounter errors such as "Fatal error: Call to undefined function ssh2_connect()". This indicates that SSH2 is not installed properly. To resolve this issue, follow the steps below:
Visit the official website and download the appropriate version of the Win32 SSH2 PECL extension for your PHP version.
Extract the contents of the archive into a temporary folder.
Move the following files to the "ext" folder where PHP modules are located:
Copy the "libssh2.dll" file to the following locations:
Run the following command in Command Prompt:
C:\> regsvr32 libssh2.dll
Restart your Apache web server.
If you are using PHP x64, you may need to obtain the x64 version of the "libssh2.dll" and the SSH2 library. You can find these at the Win64 Compiled Libraries site.
Remember to restart Apache after making any changes.
The above is the detailed content of How do I fix the \'Fatal error: Call to undefined function ssh2_connect()\' error when installing SSH2 on Windows?. For more information, please follow other related articles on the PHP Chinese website!