Trying to install ssh2 onto a litespeed server and using the traditional install methods are not working for me. I have successfully installed ssh2 into the /etc/php/cli and it works from the command line. However my litespeed server is using the php.ini from the directory /usr/local/lsws/lsphp74/etc/7.4/litespeed/php.ini. I confirmed that by running phpinfo() from the browser and looking at the Loaded Configuration File entry which shows /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini. No matter what I try and what examples or steps provided to me, I cannot get it to install in an area that I can use via the browser. I do see this line "/usr/local/lsws/lsphp74/etc/php/7.4/mods-available/50-ssh2.ini," in the Additional .ini files parsed section of the phpinfo() page however no matter what I have tried, I cannot get it so show up like its installed when I view the phpinfo() page.
This works for LSPHP81 with SSH2, feel free to replace the PHP version with your current version.
1 - Install necessary PHP packages and ssh2 lib
apt-get update
apt-get install lsphp81-pear lsphp81-dev -y
apt-get install libssh2-1 libssh2-1-dev -y
2 - Download SSH2 package from pecl
wget https://pecl.php.net/get/ssh2-1.3.1.tgz
tar -zxvf ssh2-1.3.1.tgz
cd ssh2-1.3.1
3 - Compile ssh2 package
/usr/local/lsws/lsphp81/bin/phpize
./configure --with-ssh2=/usr/local/lsws/lsphp81 --with-php-config=/usr/local/lsws/lsphp81/bin/php-config
make
make install
echo "extension=ssh2.so" >> /usr/local/lsws/lsphp81/etc/php/8.1/mods-available/ssh2.ini
4 - Reload lsws and PHP
systemctl restart lsws
killall lsphp
5 - Result
Related
Can anyone help me install php-redis in MAC OSX .
brew install php-redis
not working.
pecl install php-redis
also not working getting -
invalid package name/package file "php-redis".
Homebrew Error:
homebrew_error
git clone https://www.github.com/phpredis/phpredis.git
cd phpredis
phpize && ./configure && make && sudo make install
Add extension=redis.so in your php.ini
brew services restart php#7.2
make test
You can check working or not
php -r "if (new Redis() == true){ echo \"\r\n OK \r\n\"; }"
As of 2019, with homebrew php7.2 and up, pecl is now installed by default alongside the php binaries.
To see this for yourself type which pecl.
Steps to install
Check your version of redis, then find a suitable version of the extension here.
If unfamiliar with pecl, type pecl to see the options.
Issue pecl install redis-5.0.2. (or your version). Enter no to each question asked if you're not sure.
If that succeeds check the new file it created at: /usr/local/lib/php/pecl/20180731/redis.so
The install will have added extension="redis.so" to top of your php ini.
Check that by opening the file /usr/local/etc/php/7.3/php.ini.
(assuming you're on 7.3 there)
brew services restart php.
php -i | grep Redis
Redis Support => enabled
Redis Version => 5.0.2
This is what I just did in September 2019 and it works for me.
If what mwal wrote above doesn't work (please try his/her answer first),
first, try to uninstall first (if you have it but broken):
sudo pecl uninstall redis
and after that run:
sudo pecl install redis
After that, ini the php.ini, use full path for the extension.
Mine was /usr/local/Cellar/php#7.3/7.3.21/pecl/20180731/redis.so (assuming you are using php#7.3)
so at the top of my php.ini file is like this:
extension="/usr/local/Cellar/php#7.3/7.3.21/pecl/20180731/redis.so"
Here are steps to use pickle, for PHP >= 7.3 (tested with 8.1):
brew install pickle
pickle install redis
Find your php.ini location via php -i|grep php.ini
Edit the php.ini, insert extension=redis. Preferable at Dynamic Extensions section.
No restart of Apache httpd service is required. You may test your PHP code with Redis
Bonus
If you use VS Code, to enable intellisense / auto complete, at Preference -> paste intelephense.stubs at Search setting box -> Add Item -> select redis.
If you got the following error,
Please make sure the PHP Redis extension is installed and enabled
despite doing everything in the verified answer above, try valet restart . It worked for me
I have tried all these solutions but didn't work for me for a while so I tried this link https://developer.redis.com/develop/php/ from the original docs and it works as charm
If someone gets an error during sudo pecl install redis
Warning: mkdir(): File exists in System.php on line 294
PHP Warning: mkdir(): File exists in /opt/homebrew/Cellar/-----/pear/System.php on line 294
that means you need to create the broken directory manually.
Try to create the directory...
pecl config-get ext_dir | pbcopy
mkdir -p {paste clipboard value}
# in my case, it was
mkdir -p /opt/homebrew/lib/php/pecl/20200930
Now try to install any pecl extensions.
sudo pecl install redis
After installing any extension, restart php
brew services restart php
Happy coding :)
I need to add curl to my PHP, I read multiple articles which recommended just sudo apt-get install php5-curl
But when I try it I get error as below
Error:
The following packages have unmet dependencies:
dropbox : Depends: python-gtk2 (>= 2.12) but it is not going to be
installed
php5-curl : Depends: php5-common (= 5.4.45-1~dotdeb+6.1) but
5.4.31-1~dotdeb.0 is to be installed
So I go a bit deeper and try to install it manualy, so I basicly download curl from curl website with: wget http://curl.haxx.se/download/curl-7.36.0.tar.gz
and then just unpack it and just ./configure and sudo make and after that sudo make install
Dispite the fact i didnt get any error It also didnt help.
From error I see that I have older version of my PHP than one in repository but I really have no clue what I can do now.
Is here anyone who can help me?
If you're stuck with that version of PHP, you can build the cURL extension yourself and then activate it with PHP. Normally, cURL is compiled into the PHP binary but you can also run it as a dynamic extension.
When you downloaded, compiled, and installed cURL, this installed the curl program and libraries but has nothing to do with PHP.
You can follow these steps to build a cURL PHP extension for your system:
Go to http://php.net/releases and download the source code for the version of PHP you are currently running
Extract to a temporary location
From the command line, cd to php-5.x.x/ext/curl
Run the following commands:
phpize
./configure --with-curl=/usr/local (/usr/local should be correct, but you can try leaving it blank, or specify the --prefix you used when you installed cURL.
make && make install
After make install runs, it should say something like:
Installing shared extensions: /usr/lib/php5/20121212/
This is where it will place curl.so
Now, edit your php.ini file that PHP uses and add:
extension=curl.so
Restart your webserver &/or PHP, check that cURL is loaded.
Note: If you don't have the phpize (it should have come with PHP) you might need to just build PHP to a temporary location and copy phpize to /usr/bin so you have it.
Hope that helps.
You need to update your PHP version and then install curl.
Do apt-get update to get the latest definitions, then apt-get upgrade to upgrade all packages, then apt-get install php5-curl.
My operating system is:Mac OSX 10.11
I'm trying to install Phabricator on my Mac, when I execute the command of
phabricator cpopt$ ./bin/phd start
I got an error:
"ERROR: The PHP extension 'pcntl' is not installed. You must install it to run daemons on this machine."
I've search this problem on google and I got lots of solutions,but they all don't work to me,I'm almost in despair.
How can I achieve that?
Do you have brew installed (read here to install http://brew.sh/)?
Try:
brew install php
or if you need to install PHP 5.6 with brew you could do this:
brew install php#5.6
Then to include it in your PATH (if it is not automatically added), it may be necessary to run the commands in the CLI you may need to update your path, e.g. (this is the case if you were to brew install php#7.1 but was not the case when I just tested with brew install php - if you are using bash instead of zsh, change .zshrc to .bashrc.
echo 'export PATH="/usr/local/opt/php#7.1/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php#7.1/sbin:$PATH"' >> ~/.zshrc
If that doesn't work, I wonder if phabricator is calling the right version of php.
Out of curiosity, what is the output you get from this? That is what phabricator is using to determine your php version.
/usr/bin/env php -v
Also... is your php.ini updated to have the pcntl extension? Run this to see your modules and look for pcntl:
php -i | grep pcntl
Double-check the php.ini that the php-cli is running:
php -i | grep php.ini
I had to do this to install the platform.sh command line tool. This was the top hit in Google so I'm adding this information. The process I followed was as below.
In Terminal:
Add yourself to the 'wheel' user group.
sudo dscl . append /Groups/wheel GroupMembership <username>
Grant group write access to /usr/local/bin
sudo chmod -R g+w /usr/local/bin
Link libpng for brew
brew link libpng
Install pcntl for php (5.6 in my case)
brew install homebrew/php/php56-pcntl
Just in case anyone else uses MAMP, I recently updated it to the latest version. Then I was getting the error
"ERROR: The PHP extension 'pcntl' is not installed. You must install it to run daemons on this machine."
I had not restarted my terminal since I updated it. After reloading the session everything worked fine.
How do I install mbstring with PHP on CentOS 6.2
I've tried:
$ sudo yum install php-mbstring
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirror.net.cen.ct.gov
* extras: centos.aol.com
* updates: mirrors.seas.harvard.edu
Setting up Install Process
No package php-mbstring available.
Error: Nothing to do
But no packages were found?
do the following:
sudo nano /etc/yum.repos.d/CentOS-Base.repo
under the section updates, comment out the mirrorlist line (put a # in front of the line), then on a new line write:
baseurl=http://centos.intergenia.de/$releasever/updates/$basearch/
now try:
yum install php-mbstring
(afterwards you'll probably want to uncomment the mirrorlist and comment out the baseurl)
If you have cPanel hosting you can use Easy Apache to do this through shell. These are the steps.
Type the Easy Apache PathType the path for Easy Apache
root#vps#### [~]# /scripts/easyapache
Do not say yes to the "cPanel update available".
Continue through the screens with defaults till you get to the "Exhaustive options list".
Page down till you see the Mbstring extension listed and select it.
Continue through the Steps and Save the Apache PHP build.
Apache and PHP will now rebuild to include the mbstring extension. Wait for the process to finish ~10 to 30 minutes. Once the process is finished you should see the Mbstring extension in the phpinfo now.
For more detailed steps see the article
Installing the mbstring extension with Easy Apache
Please check your /etc/yum.conf file, maybe it is exclude php packages.
You should remove php* from this line so you can download php-* packages:
exclude= courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* php*
It's seems your server having some scripts like cPanel
*Make sure you update your linux box first
yum update
In case someone still has this problem, this is a valid solution:
centos-release : rpm -q centos-release
Centos 6.*
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm
Centos 5.*
wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm
Then just do this to update:
yum --enablerepo=remi upgrade php-mbstring
Or this to install:
yum --enablerepo=remi install php-mbstring
Find out php version - php -v
Search for php extensions available - yum search php-
Install using - yum install ea-php56-php-mbstring.x86_64
Then httpd -k restart
Package name - ea-php-php-mbstring.x86_64
yum install php-mbstring (as per http://php.net/manual/en/mbstring.installation.php)
I think you have to install the EPEL repository http://fedoraproject.org/wiki/EPEL
None of above works for godaddy server centOS 6, apache 2.4, php 5.6
Instead, you should
Install the mbstring PHP Extension with EasyApache
check if you already have it by, putty or ssh
php -m | grep mbstring
[if nothing, means missing mbstring]
Now you need to goto godaddy your account page,
click manager server,
open whm ----- search for apache,
open "easy apache 4"(my case)
Now you need customize currently installed packages,
by
click "customize" button on top line next to "currently installed package..."
search mbstring,
click on/off toggle next to it.
click next, next, .... privision..done.
Now you should have mbstring
by check again at putty(ssh)
php -m | grep mbstring [should see mbstring]
or you can find mbstring at phpinfo() page
As yum install php-mbstring then httpd -k restart didn't do it for me, I think these options should be compiled, as documented here:
Now, configure and build PHP. This is where you customize PHP with
various options, like which extensions will be enabled. Run
./configure --help for a list of available options. In our example
we'll do a simple configure with Apache 2 and MySQL support.
If you built Apache from source, as described above, the below example
will match your path for apxs, but if you installed Apache some other
way, you'll need to adjust the path to apxs accordingly. Note that
some distros may rename apxs to apxs2.
cd ../php-NN
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-mbstring
make
make install
If you decide to change your configure options after installation,
you'll need to re-run the configure, make, and make install steps. You
only need to restart apache for the new module to take effect. A
recompile of Apache is not needed.
Note that unless told otherwise, 'make install' will also install
PEAR, various PHP tools such as phpize, install the PHP CLI, and more.
Though this page says it's optional:
--enable-mbstring
Allows multibyte character string support. This is optional, as slower custom code will be used if not available.
I have experienced the same issue before. In my case, I needed to install php-mbstring extension on GoDaddy VPS server. None of above solutions did work for me.
What I've found is to install PHP extensions using WHM (Web Hosting Manager) of GoDaddy. Anyone who use GoDaddy VPS server can access this page with the following address.
http://{Your_Server_IP_Address}:2087
On this page, you can easily find Easy Apache software that can help you to install/upgrade php components and extensions. You can select currently installed profile and customize and then provision the profile. Everything with Easy Apache is explanatory.
I remember that I did very similar things for HostGator server, but I don't remember how actually I did for profile update.
Edit:
When you have got the server which supports Web Hosting Manager, then you can add/update/remove php extensions on WHM. On godaddy servers, it's even recommended to update PHP ini settings on WHM.
sudo yum install php<version>w-mbstring
ex.
sudo yum install php56w-mbstring
If none of the above help you out, and you have the option, try obtaining one of the rpm files eg:
wget http://rpms.famillecollet.com/enterprise/6/remi/x86_64/php-mbstring-5.4.45-2.el6.remi.x86_64.rpm
then using rpm, install it ignoring the depenecies like so:
rpm -i --nodeps php-mbstring-5.4.45-2.el6.remi.x86_64.rpm
Hope that helps out.
I'm having trouble installing the "memcached" PHP extension from PECL, though I can successfully installed the "memcache" extension. (They are separate PHP extensions.)
For example, these commands work okay:
$ sudo pecl install memcache
$ sudo pecl install APC
$ sudo pecl install oauth
However, attempting to install memcached causes errors:
$ sudo pecl install memcached
...
ld: library not found for -lmemcached
collect2: ld returned 1 exit status
make: *** [memcached.la] Error 1
ERROR: `make' failed
I'm using pecl, memcached, and libmemcached from Mac Ports (macports.org) on a recent Intel Mac. The libmemcached libraries can be found in /opt/local:
/opt/local/include/libmemcached
/opt/local/include/libmemcached/libmemcached_config.h
/opt/local/lib/libmemcached.2.0.0.dylib
/opt/local/lib/libmemcached.2.dylib
/opt/local/lib/libmemcached.a
/opt/local/lib/libmemcached.dylib
/opt/local/lib/libmemcached.la
Any idea what I may be doing wrong?
Andrei Zmievski (developer of the memcached plugin) kindly answered my email request with the following instructions:
$ pecl download memcached
$ tar zxvf memcached-1.0.0.tgz (or whatever version downloads)
$ cd memcached-1.0.0
$ phpize
$ ./configure --with-libmemcached-dir=/opt/local
$ make
$ sudo make install
This worked perfectly.
same situation here. i had to do the above, but with explicit path names (i run my php etc. out of /opt/local)
/opt/local/bin/pecl download memcached
tar zxvf memcached-1.0.0.tgz
cd memcached-1.0.0
/opt/local/bin/phpize
./configure --prefix=/opt/local --with-php-config=/opt/local/bin/php-config --with-libmemcached-dir=/opt/local
make
make install
normally this kind of stuff is pretty simple on os x with macports, but there is no php5-memcached package yet (only one for the older, memcache (no "d") package). oh, an i also had to install an older version of libmemcached, since the latest version didn't compile on os x 10.5.8 for me. oy!
As you've seen, the new memcached extension, uses libmemcached to do the heavy lifting. If it were Linux, I'd say that it was possible that you don't have /opt/local/lib/ listed in ld.so.conf (and run 'ldconfig').
MaxOSX doesn't use that though. It is, however installable from 'ports' apparently. http://lsimons.wordpress.com/2008/05/01/serious-php-part-1/
Well, after many tries only this solution works for me.
Install XAMPP
Install brew (https://github.com/Homebrew/homebrew/wiki/Installation)
$ brew
install libmemcached
cd /Applications/XAMPP/xamppfiles/bin/
$ sudo ./pecl install memcached
Build process completed successfully Installing
'/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/memcached.so'
install ok: channel://pecl.php.net/memcached-2.2.0 configuration
option "php_ini" is not set to php.ini location You should add
"extension=memcached.so" to php.ini
VOILA !!