So I have a class that I build that uses the ssh2 package in php. I have successfully set this up and used and tested this class on apache2 server. The server at work where this is going to be running is an instance of litespeed. I have scoured the web for a way to get ssh2 working with this litespeed server however I cannot for the life of me figure it out. I get ssh2_connect() function not found. If I go go /etc/php/... I can see that the ssh2.ini file exists. However I believe the active php instance is located /usr/local/lsws/lsphp74/7.4/etc/php/ where I do not see the ss2.ini located. Is there a way to get ssh2 installed in the directory that is being used by the server? If I run ssh2_connect at the command prompt, it works just fine as it is most likely using the /etc/php instance of php.
You're correct, ssh2_connect() is provided by a pecl extension. These are optional binary add-ons for php. I'd make a quick phpinfo(); page and add it to the litespeed server so you can see what modules are active and where the config files php is using are actually located on disk.
The install guide can walk you through installing this pecl extension.
https://www.php.net/manual/en/ssh2.requirements.php
Another way to accomplish this is with a pure-php library that doesn't depend on special plug-ins. phpseclib fully implements the ssh protocol in pure php, taking advantage of libraries if they are present but it's able to function without them.
since you didn't mention what exactly is your server env
I would assume it's either OpenLiteSpeed image , or CyberPanel image
first of all , compile libssh2
wget https://libssh2.org/download/libssh2-1.10.0.tar.gz
tar vxzf libssh2-1.10.0.tar.gz
cd libssh2-1.10.0
./configure
make
make install
then compile the PHP extension
mkdir /usr/local/lsws/lsphp74/tmp
pecl channel-update pecl.php.net
/usr/local/lsws/lsphp74/bin/pear config-set temp_dir "/usr/local/lsws/lsphp74/tmp"
/usr/local/lsws/lsphp74/bin/pecl install https://pecl.php.net/get/ssh2-1.3.1.tgz
echo "extension=ssh2.so" > /usr/local/lsws/lsphp74/etc/php/7.4/mods-available/50-ssh2.ini
and finally , restart lsphp process to load new module
touch /usr/local/lsws/admin/tmp/.lsphp_restart.txt
or
killall lsphp
then verify by phpinfo(); to make sure you see ssh2 loaded
Related
I installed PHP extension libsodium via PECL on Linux, and everything seemed fine as I started to test the functions, but I've noticed that some functions are working and others are not.
For example, when I call sodium_crypto_generichash and sodium_crypto_secretbox i get no errors, but when i call sodium_crypto_pwhash I get an error in PHP saying sodium_crypto_pwhash is not a function.
I'm new to PHP and Linux but I'm thinking this means my PHP library is out of date. When I call
var_dump([
SODIUM_LIBRARY_MAJOR_VERSION,
SODIUM_LIBRARY_MINOR_VERSION,
SODIUM_LIBRARY_VERSION
]);
I get
array(3){[0]=>int(9)[1]=>int(1)[2]=>string(5)"1.0.8"}
And I see at https://github.com/jedisct1/libsodium/releases the latest release is 1.0.16
So I would like to install the latest library. As I'm new to Linux I'm trying to do this in the terminal and I don't know what to do. these are the steps I followed to this point, starting from my home directory
wget https://github.com/jedisct1/libsodium/releases/download/1.0.16/libsodium-1.0.16.tar.gz (downloads the file ok)
tar -xvzf libsodium-1.0.16.tar.gz (unzips the file ok, creates libsodium-1.0.16 directory)
cd libsodium-1.0.16 directory
Now what?
Any help would be appreciated.
Hi i'm really having a hard time here,
I'm trying to install gearman job/task queue. I'm using windows, wappstack to be exact, then followed exactly the instructions here, and so far so good. I think I've installed the gearman server.
But I can't seem to find how to actually install PECL extension for gearman. I mean I can't find any .dlls to add to the PHP ext folder. and the PECL Package here just makes me all the more clueless. I can't invoke Gearman classes, and when I use phpinfo(); , gearman extension is just not present. I'm absolutely clueless on this.
How do I add and properly set up gearman extension to my PHP? Please and Thank you!
To you install a extensions of PECL you need use the cmd.
Open the cmd.
Go to directory where is the PHP program.
Find for "pecl.exe"
Install gearman extension.
Like:
$ cd C:/BitNami/wappstack-[version]/php/
$ pecl install gearman
Now, looking for the "php_gearman.dll" in the extension directory.
And add extension to php.ini
http://php.net/manual/en/install.windows.extensions.php
http://php.net/manual/en/install.pecl.php
Just installed OpenCV 2.4.7 manually in a custom dir on my hosted CentOS 6.4 box. However, when I now try to "./configure" a program called OpenCV-for-PHP that depends on the OpenCV library, it doesn't recognize this new version and still automatically refers to the "old" OpenCV installation (version 2.0.0) that was installed through yum.
The question is: what do I have to set in order to make OpenCV in my custom directory the actively used OpenCV, that will be used during the ./configure stage? (instead of the one it looks up now, which was installed through yum) I've tried:
[root#srv]# export LD_LIBRARY_PATH="/home/userhome/opencv/opencv-2.4.7/build/lib"
[root#srv]# export PKG_CONFIG_PATH="/home/userhome/opencv/opencv-2.4.7/build/lib"
[root#srv]# export PATH=/home/userhome/opencv/opencv-2.4.7/build/lib:$PATH
None of these seem to do the trick, however. pkg-config also still displays the old version after adding these vars.
[root#srv]# pkg-config --modversion opencv
2.0.0
[root#srv]#
Running "./configure" still displays the same dreaded message and exits prematurely:
[root#srv1 OpenCV-for-PHP]# ./configure
(...)
checking for pkg-config... found
checking for opencv... too old
configure: error: Ooops ! You need at least opencv 2.1.0
Maybe it is possible to feed a specific parameter into the ./configure with a value set to my custom OpenCV install dir? (ie. ./configure --opencvpath=/home/usern/opencv/lib/)
All suggestions that might fix this issue are welcome!
PKG_CONFIG_PATH was pointing to the wrong directory. This var has to point to the pkg-config dir containing .pc files, ie. in our server's case "/usr/local/lib/pkgconfig".
By opening the .pc file for OpenCV residing in the aforementioned directory it showed to be still pointing to the old installation. Simply change the value here to the custom path you've installed OpenCV in.
PHP on Windows does not include php_phar.dll which means that
when installing pear i have to do it like this php -d phar.require_hash=0 go-pear.phar because it would not install Graph part of pear
I cant use MakeGood for unit testing in Eclipse
I cant use phar in general
is there a way to get to the php_phar.dll or pear community just decided that they wont support windows servers?
The phar extension is now a part of PHP that cannot be removed (statically built), so you do not need a .dll file for it.
Run php -m to see it listed.
Am trying to install a package which has given instructions to use Buildconf from the root of php build directory. In my php build directory's root(/etc/php5), I don't find a Buildconf or Configure script. How do I get these? I installed my php5 using sudo apt-get(yes, I have an Ubuntu).
What you probably have installed is PHP binary package, i.e. already built one. If you need to build a stand-alone PHP module, you may want to install package php5-dev and use utility /usr/bin/phpize5 to generate config files.
If what you really need is PHP source, you may download it from http://www.php.net/downloads.php. After you unpack the package, buildconf will be there.
If neither of these is what you need, I guess it would be helpful to post the instructions you received.