Hi all.

I'm running PHP 5.3.3 on a Windows Server 2008 R2 machine, on IIS. Now I have the need to connect to another server via SSH to get some information, and I found the SSH extension on php.net.

I downloaded this file: php_ssh2-svn20091128-5.3-nts-vc9-x86.zip

Well, I added the file php_ssh2.dll to C:\PHP\ext, and added the following rows to php.ini:

extension_dir = "ext"
extension=php_ssh2.dll

I have restarted IIS, but no luck. I added just one row to a .php-file, namely this one:
<?php $connection = ssh2_connect('192.168.1.123', 22); ?>

All I get is "500 - Internal server error" when running this script. So, if anyone has a clue as to what causes this, I would be extremely grateful.

Cheers.

    I can't seem to find a VC6 version of the php_ssh2.dll file, so I can't test it out myself. However, one thing you can try is to give extension_dir an absolute path to the 'ext' directory instead of a relative one.

    Also, try enabling display_startup_errors and see if any error messages pop up when you restart IIS.

    Finally, have you verified that your php.ini file is being read by PHP? One easy way to do this is to view a phpinfo() printout and take note of the value of one of the directives (e.g. display_errors). Then, open the php.ini file and modify that directive's value; once you restart IIS, you should be able to do another phpinfo() and verify that the new value is reflected.

      Great input, thanks! It seems that I have now gotten a little bit further, at least... I did everything you listed above, and the php.ini is read just fine. This is the error I get when executing my script:

      Fatal error: Call to undefined function ssh2_connect() in C:\inetpub\wwwroot\test.php on line 2

      However, I also checked the Event Log like you said, and saw this:
      Activation context generation failed for "C:\PHP\ext\php_ssh2.dll". Dependent Assembly Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.

      Any ideas at all?

        Write a Reply...