Ssh2 - how to implement in executable

How does one go about implementing ssh2 in ExeOutput for windows. I use phpseclib 1.0.7 with php 5.6 on a Linux server. I would like to compile a small comm app for window to query the Linux system using ssh2. I can do this now Linux to Linux but I don’t know how I go about moving the functions to a Windows executable.

Thank you for any help you can provide.

Download the PHP extension here:
https://windows.php.net/downloads/pecl/releases/ssh2/1.1.2/php_ssh2-1.1.2-7.1-nts-vc14-x86.zip
Unzip php_ssh2.dll and place it into the “PHPRuntime7\ext” folder of ExeOutput.
Start a new project in ExeOutput, go to PHP Setting, choose PHP 7.1.
Then, in “PHP Extensions”, enable php_ssh2.dll.
The functions should now be recognized by your ExeOutput app.

Thanks for the reply.

I did as suggested above and this is what I get back:
PHP Warning: PHP Startup: Unable to load dynamic library ‘php_ssh2.dll’ (tried: C:\Users\donbar\PhpstormProjects\Compile\Data\ext\php_ssh2.dll (The specified module could not be found.), C:\Users\donbar\PhpstormProjects\Compile\Data\ext\php_php_ssh2.dll.dll (The specified module could not be found.)) in Unknown on line 0

The dll is there as well as in the ExeOutput ext folder.
I am obviously not understanding something here.

Thanks again.

Yes, you didn’t understand

You had to put your extension to every used php directory extension folder eg

C:\Program Files (x86)\ExeOutput for PHP 2018\PHPRuntime72\ext

Then after restard exeoutput compiler this extension shows up in extension module, where you need to compile it in your application like eg curl

image

I have the php_ssh2.dll in the correct folder as was instructed in the first message and it is enabled in the extension list.

I continue to get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library ‘php_ssh2.dll’ (tried: C:\Users\donbar\PhpstormProjects\Compile\ext\php_ssh2.dll (The specified module could not be found.), C:\Users\donbar\PhpstormProjects\Compile\ext\php_php_ssh2.dll.dll (The specified module could not be found.)) in Unknown on line 0

Why is it looking for the dll in C:\Users\donbar\PhpstormProjects\Compile\ext\
and
where does this come from: C:\Users\donbar\PhpstormProjects\Compile\ext\php_php_ssh2.dll.dll

I have the absolute path for virtual data set to C:\Users\donbar\PhpstormProjects\Compile\

Don’t activate “absolute path” yet: this will only add complexity to your project.

Just tested SSH2 extension and SSH2 functions are correctly recognized once the extension is enabled:

image

I set up a completly new project with only one file to compile. I enable ssh2 in the php extensions (as I have done all along). I did not make any other changes. Then I compiled.
The following is the file list generated.

Adding PHP runtime components

  • Php extensions
    o php_ssh2.dll compiled
  • php.ini
  • PHP ExeOutput extension
  • PHP opcache extension
  • ExeOutput internal extension

Notice that in your test a dependency is include: libeay32.dll. It is not in my list.
When I run the program I still get the same error:
PHP Warning: PHP Startup: Unable to load dynamic library ‘php_ssh2.dll’ (tried: C:\Users\donbar\Documents\Data\ext\php_ssh2.dll (The specified module could not be found.), C:\Users\donbar\Documents\Data\ext\php_php_ssh2.dll.dll (The specified module could not be found.)) in Unknown on line 0

Maybe left field advice, but have you tried compiling with the php_openss.dll ?

Thanks for the advice but no go. Same result.

Where is EXOPHPDATAPATH defined? It is not in my system variables.

One More Try !

Project Path:
C:\Users\donbar\Documents\TestCompile2\

Configuaration
php Version 5.6
php_ssh2.dll USED:compile into the EXE
No changes to the ini

Compile Result:
Adding PHP runtime components

  • Php extensions
    o php_ssh2.dll compiled
    o dependency libssh2.dll compiled
  • php.ini
  • PHP ExeOutput extension
  • PHP opcache extension
  • ExeOutput internal extension

Compilation Successful
ExeOutput has successfully built your application.
Path to Application File: C:\Users\donbar\Documents\InterfaceAPI.exe
File Size: 7.5 MiB, 7916725 byte(s).

Execution Results:
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Users\donbar\Documents\Data\ext\php_ssh2.dll’ - The specified procedure could not be found.

My Question is still the same. Why is it trying to load the dll from ‘C:\Users\donbar\Documents\Data\ext’ ? If it is compiled into the executable why is it trying to load it at all?

It’s the error you made: you forgot to change to PHP 7.1. The extension indicated in the 1st post is for 7.1 and not 5.6. Otherwise, PHP won’t load it.

Ok. I stand corrected. Changing it to 7.1 worked. Thank you for your patience.