enable php_ssh2 on Windows 8 - php

I am trying to use php_ssh2 to send commands via sftp to a raspberry pi from a windows server with xampp as web server and PHP 5.5.
I could not make it work although I followed the procedure at PHP Install SSH2 on Windows machine.
Maybe there are some updates for Windows 8.
When I try to register libssh2.dll i get an error (it is not a valid .dll) although I downloaded the latest version.
If I execute php -i I get this error: "PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_ssh2.dll' - it is not a valid Win-32 Application"
The operation system is Windows 8 64bit.
Any suggestion?

My recommendation: use phpseclib, a pure PHP SSH2 implementation. eg.
<?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
exit('Login Failed');
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>
It has a number of advantages over libssh2:
more portable.
easier to use.
faster
better public key support
etc.

First you need to find
Architecture - 32 bit or 64 bit or 86 bit
compiler version - VC9 or VC11 or VC14
Thread safe or Non thread safe
This can be find by open phpinfo or echo phpinfo() in any php file. Then search for Compiler,Architecture and Thread Safety
Then go to http://windows.php.net/download/ and download right Releases. Replace needed file then restart web server

download library for x64 system, here >
ssh2 library 0.12 for PHP 5.5 - Non Thread Safe (NTS) x64
ssh2 library 0.12 for PHP 5.5 - Thread Safe (TS) x64

Related

php oci8 ext not loading Unable to load dynamic library

I am trying to connect my PHP 7.0 with Oracle database(11g release 2) for that I download dll files of oci8 extension from https://pecl.php.net/package/oci8/2.1.7/windows and copy php_oci8.dll and php_oci8_11g.dll in my xampp/php/ext after that I restart my xampp server.
My System type is: 64bit operating system x64 based processor
when using 7.0 Non Thread Safe (NTS) x64 extension getting this error on cmd
when using 7.0 Non Thread Safe (NTS) x84 extension getting this error on cmd
why these dynamic libraries are not loading what I need to do to connect php 7 with Oracle 11g release 2 in 64-bit windows 10 operating system please help me about this
Please check phpinfo to see if thread safety is enabled on your XAMPP server. (It seem to be enabled by default on xampp.) Also, check if your XAMPP is 32-bit or 64-bit. (There seems to be only 32-bit version available on Windows?) Then download OCI8 pecl package accordingly.
Here is what I got:
PHPInfo on my Windows Xampp server
Hence, I downloaded "7.1 Thread Safe (TS) x86".
FYI, oci8_2.1.8 is released this week. It fixes a critical reference count issue.

How to find which version of libssh2 is required for my php version (on Windows)

When I check my php version I get the following warnings:
PHP Warning: PHP Startup: ssh2: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
These options need to match
in Unknown on line 0
I'm trying to understand which versions work together and how I can get hold of the correct version to setup PHP with SSH2. I have been able to find the .tar.gz versions of libssh from places like the following:
https://www.rpmfind.net/linux/RPM/remi/enterprise/6/x86_64/php56-php-pecl-ssh2-0.12-4.el6.remi.x86_64.html
The problem is I am using a Windows machine and not Linux. Does anyone know whether I can get the same libssh version for Windows? Or do I have to downgrade PHP to the same level as ssh2? Or is it nothing to worry about it and just a quirk of Windows?
Here are some details that might be of use:
OS: Windows 10 (x64)
PHP Version: PHP 5.6.15 (cli) (built: Oct 29 2015 12:39:50)
Microsoft Visual C++ 2015 Redistributable (x64) 11.0.61030
Server version: Apache/2.4.17 (Win64)
Apache Lounge VC11 Server built: Oct 13 2015 11:37:51
In addition... I've found the version of the ssh2 zip that I downloaded. It was 5.5 Thread Safe (TS) x64 from: https://pecl.php.net/package/ssh2/0.12/windows
So, I guess that means I need to downgrade my PHP to 5.5 for this to work properly. Is that correct or is there a better way?
I've found a solution to the problem. As stated in the OP the problem was that the PHP module was a later version than the SSH2 module. The question was how to find the versions that would work with the setup stated. This proved to be quite tricky because there were more systems that needed to be integrated than I first thought. I falsely assumed that the latest versions would all play nice together.
As I am running Windows 10 64-bit I wanted to get the stable version of PHP that runs against this - that would be PHP 7. As stated here: http://windows.php.net/download/. Initially I downloaded PHP 7.0 but this didn't play nicely with another module that I wanted to install, which was MongoDB.
When I looked into MongoDB I realised that there wasn't a driver for PHP 7.0 yet so the latest one I could get was PHP 5.6. This meant that I had to settle for an "experimental" 64-bit version of PHP. So I made the shift and everything was playing nice until I decided that I wanted to get Composer so that I could manager my PHP dependencies.
When I tried to intall Composer using the Windows installer it failed with an unknown exception and suggested I try from the command line to get a better error response. So I duly did and the error stated that the ssh2 module was not compatible with PHP 5.6.
That eventually brought me to ask the question on stackoverflow.
After some more digging into what versions of ssh2 there are I was brought to the following page: http://windows.php.net/downloads/pecl/releases/ssh2/0.12/
This told me that the latest version of PHP that was compatible with the SSH2 extension was PHP 5.5. So... it looks like the solution was to downgrade to version 5.5.
When I started looking for the new (old) version to download I came across this wonderful bundle package site: https://www.apachelounge.com/viewtopic.php?t=6123
From there I could download this version (https://phpdev.toolsforresearch.com/php-5.5.20-Win32-VC11-x64.zip) and it would contain all the modules that I needed in the correct version.
So, in conclusion, a little more up-front analysis into what versions play nice together would have helped or understanding that the Apache Lounge has all the versions that work together in a nice tidy bundle.

SSH2 dll not being loaded - windows server 2008 64bit, php 5.3.5 32bit, apache 32 bit

I have followed the instructions here: PHP Install SSH2 on Windows machine amongst other places.
Please note I am at work and cannot change this development environment.
Using
if (extension_loaded('ssh2'))
I can see the extension has not been loaded.
I tried using both the TS and NTS files from here: http://windows.php.net/downloads/pecl/releases/ssh2/0.12/ for PHP 5.3 (I am version 5.3.5).
I am have placed php_ssh2.dll and php_ssh2.pdb files in the correct ext folder for PHP (I have confirmed this is the right ext folder using the phpinfo() command).
I have added extension=php_ssh2.dll to the php.ini file, again ensuring it's the right ini file using the phpinfo() command
I have added libsshl2.dll to both syswow64 and system32 folders
When I try to register either of those using command line prompts it fails but I have been told by my other question this is because libssh2.dll is not a COM server so cannot be registered - How do I register a php dll with windows if it's 64 bit windows but 32 bit php and apache? I have tried running the commands as the administrator
Apache has been restarted. There is nothing in the error log.
Please help, tearing my hair out over this one
honlestly i think youd be better off with phpseclib. libssh2 is notoriously difficult to use. its not well maintained and isnt even as feature packed as phpseclib is. more info on the advantages of phpseclib over libssh2:
http://phpseclib.sourceforge.net/ssh/compare.html
example:
<?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
exit('Login Failed');
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>
Take a look at this answer.
It seems that for each version of php, you will have the exactly version of ssh2. You cannot run a ssh2 dll if it is not built with that php version
So check the version out, pay attention that there are two download links, for 32 or 64.
https://stackoverflow.com/a/16480426

PHP 5.4 php_ssh2 dependend library libssh2.dll can't register in window server 2008-x64

Recently I deploy php 5.4.17-nts- version on windows server 2008 -x64 R2 standard. I download php5.14.17 from http://windows.php.net/download/ and php extension ssh2 (php_ssh2-0.12-5.4-nts-vc9-x86.zip) from http://windows.php.net/downloads/pecl/releases/ssh2/0.12/.
But, after I add ssh2 extension on php.ini file and check version of php, it throw an error message "The program can't start because libssh2.dll is missing from your computer. Try reinstalling the program to fix this problem".
I execute command regsvr32.exe to registered "libssh2.dll", but failed.
Interesting, if i use version php 5.3 and 0.11 version ssh2, it doesn't show any error message, ssh2 version 0.11 for php 5.3 has only one dll php_ssh2.dll on php_ssh2-0.11.2-5.3-nts-vc9-x86 folder. However on php_ssh2-0.12-5.4-nts-vc9-x86.zip contains 3 files one php_ssl.dll and another is libssh2.dll and pdb file.
Queries to know
1) php_ssh2-0.11.2-5.3-nts-vc9-x86 contains only one dll (php_ssl.dll), but php_ssh2-0.12-5.4-nts-vc9-x86.zip contains 2 dll (php_ssh2.dll, libssh2.dll) and one pdb file, why it's different?
2) What is reason behind windows server 2008 - x64 R2 standard server doesn't registered libssh2.dll
I almost wonder if this question might be better suited to serverfault.com or superuser.com.
Anyway you might have better luck with phpseclib, a pure PHP SSH2 implementation.

php_redis.dll not working in windows

I tried both the files from here: https://github.com/nicolasff/phpredis/downloads. I am using 64bit wampserver on windows 7 professional. It looks like apache is trying to load the file but somehow could not recognize it properly. This is what I see in the error log:
PHP Startup: Unable to load dynamic library
'D:/wamp/bin/php/php5.3.13/ext/php_redis.dll' - %1 is not a valid
Win32 application.
Anyone faced similar issues? Do we have a working solution for this?
Just in case it can help someone, I managed to solve the error on PHP 7.1.12 installing the 32 bits DLL.
I was getting the error:
Warning: PHP Startup: Unable to load dynamic library '.../php_redis.dll'
not a valid Win32 application
But after installing the 32 bits version, the warning disappeared.
To know which architecture of XAMPP/WAMP are you using, visit the phpinfo() and look for the value "Architecture", it was for me on the fourth row, and as expected is had the value x86.
I had to check the Server API from phpinfo() to decide which version to use
If It's
Apache 2.0 Handler(mod_php) go with Thread Safe version
If It's CGI go with Non Thread Safe version
Unfortunately I do not run 64-bit version of PHP to test this, but for PHP 5.3 you can try this dll.
Dll from https://github.com/nicolasff/phpredis/downloads ( php_redis-2.1.3-5.2-vc6-ts-4350b2a.zip ), is working fine with PHP 5.2.17 (32-bit version).
I hope you will solve the problem.
I used XAMPP x86 / PHP 7.2.5 so I needed redis x86 and the directory is this: C:/xampp/php/ext/.
https://pecl.php.net/package/redis/4.1.0/windows
I'll add my ansewer to the table :
I used those dlls for my AMPPS server (WAMP should be the same) under windows 8 with PHP 5.5:
https://pecl.php.net/package/redis/2.2.7/windows
following this tutorial
https://www.linkedin.com/pulse/using-redis-windows-php-shekhar-joshi
I had same issue for 64 bit windows 7 wampserver with PHP5.5.12
and worked for me from below link dll binaries of Redis
http://windows.php.net/downloads/pecl/releases/redis/2.2.7/
I had the same case, I was installing wamp 32bit, but I imported the library in 64bit however I had to imorted the 32bit version.
Check in the task manager which version of wamp you are using!
For me the reason was version of Redis PHP extension that I've been used.
xampp architecture: x64
php version: 7.4
php type: ts (thread safe)
redis version installed on windows: 3.0.504
and finally the version of Redis PHP extension that worked for me was:
for php 7.4
latest stable version: php_redis-5.3.4-7.4-ts-vc15-x64
I downloaded it from this Link

Categories