Heya, so I've spent about 6 hours now trying to get this working. I had the following set of rules I uses to compile in the memcached plugin to php, installing libmemcached dependency first. Here are the steps:
cd ~
sudo wget http://download.tangent.org/libmemcached-0.35.tar.gz
sudo tar -zxf libmemcached-0.35.tar.gz
cd libmemcached-0.35
sudo ./configure
sudo make
sudo make install
cd /usr/lib
sudo ln -s /usr/local/lib/libmemcached.so
sudo pecl install memcached
sudo rm -r ~/libmemcached-0.35
sudo rm ~/libmemcached-0.35.tar.gz
php.ini-edit
Search for Dynamic Extensions and add in the extension memcached.so. Do this by adding: extension=”memcached.so”
:wq
It used to work; last time I rebuilt my box was back in Feb or March, but I've heard that since then there are some changes that go on. When I run sudo make above I get some erroring out. I'm not sure if I included the error anyone could help me debug, so does anyone have a set of instructions they used to get memcached working properly on their ub box? With the libmemcached dependency?
I've seen this: Can I install the memcached PHP extension with PECL?
The author of memcached basically told the guy how to do, but I've tried that to no avail. Help with be really appreciated. Thanks.
cd ~
sudo apt-get -y install g++
wget http://launchpad.net/libmemcached/1.0/0.39/+download/libmemcached-0.39.tar.gz
tar zxvf libmemcached-0.39.tar.gz
cd libmemcached-0.39/
./configure
make
sudo make install
cd /usr/lib
sudo ln -s /usr/local/lib/libmemcached.so
sudo pecl install memcached
sudo rm -r ~/libmemcached-0.39
sudo rm ~/libmemcached-0.39.tar.gz
php.ini-edit
Search for Dynamic Extensions and add in the extension memcached.so
:wq
Related
I tried to install the decimal PHP extension using pecl because I need it for an existing project. On my new M1 machine, I got the following error:
$ pecl install decimal
[...]
checking for libmpdec library in default path... Could not find libmpdec
configure: error: Please reinstall libmpdec
ERROR: `/private/tmp/pear/temp/decimal/configure --with-php-config=/opt/homebrew/bin/php-config' failed
After researching online, I found these threads describing similar issues:
Installing php-decimal in MacOS arm64e and can't get libmpdec
https://www.reddit.com/r/PHPhelp/comments/nmryxz/trouble_installing_php_extensions_with_valet_and/
Since both threads did not include a compact explanation of what I needed to do to fix the issue, I decided to try and summarize it here.
When pecl tries to install the decimal extension, the libmpdec library is not found in the default library path. The installer tries to find the library in /usr/local/lib/ while Homebrew installs it in /opt/homebrew/lib/. To help the installer get up to speed, create symlinks for the library components and two header files:
sudo ln -s /opt/homebrew/lib/libmpdec++.2.5.1.dylib /usr/local/lib/libmpdec++.2.5.1.dylib
sudo ln -s /opt/homebrew/lib/libmpdec++.3.dylib /usr/local/lib/libmpdec++.3.dylib
sudo ln -s /opt/homebrew/lib/libmpdec++.a /usr/local/lib/libmpdec++.a
sudo ln -s /opt/homebrew/lib/libmpdec++.dylib /usr/local/lib/libmpdec++.dylib
sudo ln -s /opt/homebrew/lib/libmpdec.2.5.1.dylib /usr/local/lib/libmpdec.2.5.1.dylib
sudo ln -s /opt/homebrew/lib/libmpdec.3.dylib /usr/local/lib/libmpdec.3.dylib
sudo ln -s /opt/homebrew/lib/libmpdec.a /usr/local/lib/libmpdec.a
sudo ln -s /opt/homebrew/lib/libmpdec.dylib /usr/local/lib/libmpdec.dylib
sudo ln -s /opt/homebrew/include/decimal.hh /usr/local/include/decimal.hh
sudo ln -s /opt/homebrew/include/mpdecimal.h /usr/local/include/mpdecimal.h
After creating the symlinks, try to install the decimal extension again:
pecl install decimal
The installation should now work as expected.
Since Laravel4 requires mcrypt extension, and PHP7 doesn't seem to have mcrypt extension, is there any workaround for this to work?
Had the same issue - PHP7 missing mcrypt.
This worked for me. When asked, keep local PHP configuration files.
sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get upgrade
Restart FPM (or Apache or NGINX etc.) after installation.
I'm on Mac and with laravel valet I've solved with this:
brew install php70-mcrypt
Even if you enable mcrypt in php.ini, this issue may occur.
Try the following steps.
sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
I am working in ubuntu 16.04 and the following commands also helped me.
whereis php -shows the files with this name
php -v -shows the php version
which php -shows current php version that is running on the server
On ubuntu: According to launchpad.net the package for mcrypt is called php7.0-mcrypt.
sudo apt-get install php7.0-mcrypt to install
Open terminal with Ctrl + Alt + T and run following commands for PHP7.0 on Ubuntu 16.4
sudo apt-get install mcrypt php7.0-mcrypt
sudo service apache2 restart
php7 have mcrypt, you can enable it in php.ini and then everything will work fine.
do like this:
wget http://jp2.php.net/distributions/php-7.0.3.tar.gz
tar zxf php-7.0.3.tar.gz
cd php-7.0.3/ext/mcrypt
/php7-path/bin/phpize (when error such as configure: error: mcrypt.h not found. Please reinstall libmcrypt run apt-get install libmcrypt-dev)
./configure --with-php-config=/php7-path/bin/php-config
(sudo) make && make install .this will install the mcrypt.so in php-7.0.3/ext/mcrypt/modules
cp to the /usr/lib/php/20151012/ what is the shared extensions dir
create a mcrypt.ini in /etc/php/mods-available/ write as extension=mcrypt.so
create link to this such as sudo ln -s /etc/php/mods-available/mcrypt.ini 20-mcrypt.ini in /etc/php/7.0/fpm/conf.d
create link to this such as sudo ln -s /etc/php/mods-available/mcrypt.ini 20-mcrypt.ini in /etc/php/7.0/cli/conf.d
sudo service nginx restart
sudo service php7.0-fpm restart
yes it is.
I use, Dotdeb, an extra repository providing up-to-date all kinds of cool toys for your Debian servers like Nginx, PHP, MySQL, Redis etc.
Update your sources.list
deb http://packages.dotdeb.org {distribution} all
deb-src http://packages.dotdeb.org {distribution} all
GnuPG keys
wget https://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg
Update apt & build something amazing.
sudo apt-get update
PHP7 contains mcrypt extension internally (source-path/ext/mcrypt/).
But it depends on Libmcrypt soft.
Step 1.
Download libmcrypt-x.x.tar.gz from http://mcrypt.sourceforge.net/
and build it.
cd libmcrypt-x.x
./configure
make
make install
Step 2.
Rebuild PHP7 from source and add --with-mcrypt option.
./configure ... --with-mcrypt
Other way without rebuilding PHP7
cd php7-source-path/ext/mcrypt/
/php7-path/bin/phpize
./configure --with-php-config=/php7-path/bin/php-config
make && make install
echo "extension=mcrypt.so" >> /php7-path/ext/php.ini
Restart php
Running the command pecl install mysqlnd_qc to install the caching with APC enabled I receive the following error:
configure: error: APC is onlysupported if both APC and MySQL Query Cache are compiled statically
ERROR: `/var/tmp/mysqlnd_qc/configure --enable-mysqlnd-qc-apc=yes --enable-qc-memcache=no --enable-qc-sqlite=no' failed
Without the APC enabled it compiles fine...
PHP version: 5.3.17
Running on Amazon RDS.
What does it mean to compile APC and MySQL Query Cache statically?
How is it done?
Update 1:
As I haven't managed to compile mysqlnd_qc with APC, I tried compiling it with memcached.
Here was an interesting issue. The ./configure command didn't recognize the the option the pecl gave for memcache. I found out that the option was entered incorrectly...
So I killed the pecl installation when it was asking for the options and ran the following commands myself:
sudo ./configure --enable-mysqlnd-qc-memcache --with-libmemcached-dir=/usr/
sudo make
sudo make install
So with memcached it now works.
If running on Fedora (I guess also RedHat and CentOS) there is available a rpm:
sudo yum install php-pecl-mysqlnd-qc
Update 2:
I managed to compile with APC, see the detailed answer below.
Well found the solution:
Here is what I did:
Get php 5.3.17:
wget https://github.com/php/php-src/archive/PHP-5.3.17.zip
unzip PHP-5.3.17.zip
Get mysqlnd_qc:
wget http://pecl.php.net/get/mysqlnd_qc-1.1.1.tgz
tar -zxvf http://pecl.php.net/get/mysqlnd_qc-1.1.1.tgz
mkdir -p php-src-PHP-5.3.17/ext/mysqlnd_qc
cp -R mysqlnd_qc-1.1.1/* php-src-PHP-5.3.17/ext/mysqlnd_qc
Get APC:
wget http://pecl.php.net/get/APC-3.1.13.tgz
tar -xzvf APC-3.1.13.tgz
mkdir -p php-src-PHP-5.3.17/ext/apc
cp -R APC-3.1.13/* php-src-PHP-5.3.17/ext/apc/
Compile: (maybe don't need all on other systems)
sudo yum install bison
sudo yum install libxml2 libxml2-devel
sudo yum install autoconf213
sudo yum install httpd-devel
sudo yum install bzip2 lbzip2 bzip2-libs bzip2-devel
export PHP_AUTOCONF=/usr/bin/autoconf-2.13
./buildconf --force
make clean && make
(for me the linkage failed and had to add '-lpthread' to linkage)
make test
sudo make install
I used also the following 2 commands but I don't remember for what and when...
phpize
aclocal
Run the same ./configure as in phpinfo and add these options:
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-qc --enable-mysqlnd-qc-apc --enable-mysqlnd --enable-apc --enable-static=apc
All the --with must be replaced.
It looks like you have to compile from source giving the right .configure options.
pecl install just gives you a .so, which is a dynamic module extension, you can add via php.ini
So if you really need mysqlnd_qc with apc (do you?), you have to get the php src, and compile it
with the needed modules.
If you don´t need it, just say no or hit return when pecl install mysqlnd_qc ask you about it.
Just as the title says. I need my memcache.so to put it in the php.ini, but I cannot find it after installing it with package manager yum install memcached.
Anyone please help me.
Thanks
I don't think memcached RPM includes php extension, or centos doesn't maintain the extension. You may need to install it manually:
cd /usr/src
wget http://pecl.php.net/get/memcache-2.2.6.tgz
tar zxvf memcache-2.2.6.tgz
cd memcache-2.2.6
phpize
./configure
make
make install
If you are using XAMPP(Linux), you need to install xampp-linux-devel and use phpize in /opt/lampp/bin/. If you haven't installed devel files of Xampp yet, first you need to isntall XAMPP-devel package(expecting your XMAPP version is 1.7.7):
wget http://www.apachefriends.org/download.php?xampp-linux-devel-1.7.7.tar.gz
mv download.php\?xampp-linux-devel-1.7.7.tar.gz xampp-linux-devel-1.7.7.tar.gz
tar xvfz xampp-linux-devel-1.7.7.tar.gz -C /opt
Then try the same installation but use /opt/lampp/bin/phpize instead of phpize
cd /usr/src
wget http://pecl.php.net/get/memcache-2.2.6.tgz
tar zxvf memcache-2.2.6.tgz
cd memcache-2.2.6
/opt/lampp/bin/phpize
./configure --with-php-config=/opt/lampp/bin/php-config
make
make install
Hope this helps!
I am trying to install this
http://fr2.php.net/manual/en/book.ssh2.php
on a Centos 5 (a fork of RHEL 5).
I installed libssh2 (yum install libssh2) which is located in /usr/lib, and when I install SSH2 extension (via pecl install -f ssh2) I get this message
checking for ssh2 files in default path... not found
configure: error: The required libssh2 library was not found. You can obtain that package from http://sourceforge.net/projects/libssh2/
ERROR: `/tmp/pear/download/ssh2-0.11.0/configure --with-ssh2=/usr' failed
If I set /usr/lib, I get the same message
ERROR: `/tmp/pear/download/ssh2-0.11.0/configure --with-ssh2=/usr/lib' failed
Where is the problem?
Installing libssh2 via tar.gz from http://sourceforge.net/projects/libssh2/ help a lot (--with-ssh2=/usr/local/include/).
But :
yum install libssh2-devel
...is a better idea.
$ sudo pecl channel-update pecl.php.net
$ sudo apt-get install libssh2-1-dev
$ sudo pecl install -a ssh2-0.12
$ echo 'extension=ssh2.so' | sudo tee /etc/php5/mods-available/ssh2.ini > /dev/null
$ sudo php5enmod ssh2
yum install libssh2-devel didn't work for me:
No package libssh2-devel available.
So I downloaded rpm package from rpmfind and installed with rpm -ivh
After that just added extension=ssh2.so to /etc/php.d/ssh2.ini
This is updated answer from #klay + modification from #avn from comment under working solution for PHP 7.x.
$ sudo pecl channel-update pecl.php.net
$ sudo apt-get install libssh2-1-dev
$ sudo pecl install -a ssh2-1.0
$ echo 'extension=ssh2.so' | sudo tee /etc/php/7.2/mods-available/ssh2.ini > /dev/null
$ sudo phpenmod ssh2
Regarding line:
echo 'extension=ssh2.so' | sudo tee /etc/php/7.2/mods-available/ssh2.ini > /dev/null
Make sure that path /etc/php/7.2/mods-available is valid and there is a match with your php version.
I'm running on Centos, none of these answer were the entire solution for me. I followed these instructions:
$ sudo yum install -y gcc php-devel php-pear libssh2 libssh2-devel
But php-devel would not install, complaining about conflicts. I searched yum to find what php devel packages I had available
$> yum search php|grep devel
...
php55u-devel.x86_64 : Files needed for building PHP extensions
php56u-devel.x86_64 : Files needed for building PHP extensions
php70u-devel.x86_64 : Files needed for building PHP extensions
...
So I ran
$> sudo yum install -y php56u-devel
And it installed cleanly. Then, continuing with the instructions, I ran
$ pecl install -f ssh2
And it compiled. Then I added the extension to php
$ touch /etc/php.d/ssh2.ini
$ echo extension=ssh2.so > /etc/php.d/ssh2.ini
And on my system, instead of
$ /etc/init.d/httpd restart
I had to do
$ sudo /bin/systemctl restart php-fpm.service
So that was all the steps to install. And finally to confirm:
$> php -m|grep ssh2
ssh2
I had this problem:
I'm on a Pair.com "Advanced" hosted account, so I'm a little limited on what I'm allowed to do. I don't think I can yum nor aptitude nor any of the other pre-compiled packages.
I've downloaded and compiled libssh2. During the pecl process, it asks where the library is located. It's in "~/usr/local/lib" and I've tried several variations, including fully qualified. But I kept getting the same error.
The error message doesn't spell out precisely which file it's looking for. libssh2.so is in that directory. I know the output is supposed to be ssh2.so. I wondered if there is supposed to be an ss2.something, or libssh.nothing?
I fixed it thus. In my case, after compiling libssh2 I downloaded the PEAR tarball. The trick was:
./configure --with-ssh2=<libssh2 location> --prefix=<libssh2 location>
Another trick is that, since Pair.com is running FreeBSD, I have to do a "cd ." after the ./configure command. Otherwise, make produces a "Permission denied" error. Apparently, this is necessary on all *nix BSD flavors.
The error:
checking for ssh2 files in default path... not found
configure: error: The required libssh2 library was not found.
...can be seen in the source code.
The logic in the code reveals that it will throw this error if it cannot find /include/libssh2.h in either /usr/local, /usr or in the path supplied by the optional --with-ssh2=[DIR] directive. In other words, without customising the directive, it needs to find one of the following:
/usr/local/include/libssh2.h
/usr/include/libssh2.h
If it passes this check, it then assumes it can find the libssh2 lib at /usr/local/lib or /usr/lib.
Hopefully the info above is enough to help someone debug their issue. My own case is fairly specific and unusual (macOS with Homebrew in a custom install path), but in case it helps anyone else, here's my horrifically hacky workaround. Works perfectly lol
In a nutshell I'm creating two temporary symlinks so that pecl can find ssh2 where it expects.
# First check that neither /usr/local/include nor /usr/local/lib exists
sudo ln -s /usr/local/CustomInstallPath/Homebrew/Cellar/libssh2/1.9.0_1/include /usr/local/include
sudo ln -s /usr/local/CustomInstallPath/Homebrew/Cellar/libssh2/1.9.0_1/lib /usr/local/lib
pecl install -a ssh2-1.3.1
sudo rm -rf /usr/local/include
sudo rm -rf /usr/local/lib