Home  >  Article  >  Backend Development  >  How do I fix the \'Fatal error: Call to undefined function ssh2_connect()\' error when installing SSH2 on Windows?

How do I fix the \'Fatal error: Call to undefined function ssh2_connect()\' error when installing SSH2 on Windows?

Linda Hamilton
Linda HamiltonOriginal
2024-10-26 22:00:03400browse

How do I fix the

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:

  1. Download the Win32 SSH2 PECL Extension

Visit the official website and download the appropriate version of the Win32 SSH2 PECL extension for your PHP version.

  1. Extract the Archive

Extract the contents of the archive into a temporary folder.

  1. Place DLL Files

Move the following files to the "ext" folder where PHP modules are located:

  • php_ssh2.dll
  • php_ssh2.pdb
  1. Copy libssh2.dll

Copy the "libssh2.dll" file to the following locations:

  • C:Windowssystem32
  • C:WindowsSysWOW64 (if you have a 64-bit system)
  1. Register DLL

Run the following command in Command Prompt:

C:\> regsvr32 libssh2.dll
  1. Restart Apache

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn