Instal memcached with php7
This is solution for you complete steps to install the memcached and php7 on Ubuntu OS:
First, You get and instal the PHP-7 and memcached:
sudo apt-get update
sudo apt-get install -y tmux curl wget \
nginx \
php7.0-fpm \
php7.0-cli php7.0-curl php7.0-gd \
php7.0-intl php7.0-mysql php-memcached
Then PHP7 is installed!
Seconds, If php-memcached was not installed, we can build it manually. (However, it's likely available to install via the php7.0-memcached package now).
If you need a newer version of the PHP-Memcached module, we can build it manually. Here's how:
sudo apt-get install -y php7.0-dev git pkg-config build-essential libmemcached-dev
sudo apt-get install -y libmemcached-dev libmemcached11 git build-essential
git clone https://github.com/php-memcached-dev/php-memcached
cd php-memcached
git checkout php7
git pull
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config
make
sudo make install
Then we need to setup PHP (CLI and FPM) to use the memcached module. Edit /etc/php/mods-available/memcached.ini
, add:
; configuration for php memcached module
; priority=20
extension=memcached.so
Then enable it by including symlinks to that file in the FPM/CLI conf.d directories:
sudo ln -s /etc/php/mods-available/memcached.ini /etc/php/7.0/fpm/conf.d/20-memcached.ini
sudo ln -s /etc/php/mods-available/memcached.ini /etc/php/7.0/cli/conf.d/20-memcached.ini
Reload php-fpm to include the new changes
sudo service php7.0-fpm restart
And there we have it, PHP7 is installed, with Memcached support!
Related videos on Youtube
googol8080
Updated on September 18, 2022Comments
-
googol8080 over 1 year
How can I install memcached from php.net and work it with php7+? I tried a couple of tutorials from other sites (I do not remember now) but it does not work. Can anyone help me to do this, I am quite new with Ubuntu and web development, so anything may help me.
-
Dimitrios Desyllas over 4 yearsWhy
tmux
is required it can easily be ommited and shill have phph installed!. Also memcached has its own package as well.