編譯安裝 PHP 的 Memcached 擴充套件

2021-10-01 01:31:11 字數 2199 閱讀 1144

安裝 libmemcached 類庫

cd /usr/local/src

wget

tar zxvf libmemcached-1.0.18.tar.gz
# 進入原始碼目錄

cd libmemcached-1.0.18

# 配置指定安裝目錄

./configure --prefix=/usr/local/libmemcached-1.0.18 --with-memcached

# 配置安裝 && 編譯安裝

make

make

install

# 將 clients/memflush.cc 的 42 行和 51 行作如下修改:

int main(int argc, char *ar**)

{ options_parse(argc, ar**);

- if

(opt_servers == false)

+ if

(!opt_servers)

{ char *temp;

- if

(opt_servers == false)

+ if

(!opt_servers)

{ std::cerr <<

"no servers provided"

<< std::endl;

exit(exit_failure)

;

安裝 memcached 擴充套件

cd /usr/local/src

wget

tar zxvf memcached-3.1.3.tgz
# 進入原始碼目錄

cd memcached-3.1.3

# 通過 phpize 建立 php 的外掛程式模組

/usr/local/php/bin/phpize

# 配置

./configure --with-php-config=/usr/local/php/bin/php-config \

-with-libmemcached-dir=/usr/local/libmemcached-1.0.18/ \

--disable-memcached-sasl

# 編譯安裝

make

make

install

配置 php.ini
# 編輯 php.ini

vim /usr/local/php/etc/php.ini

#在檔案尾部增加

[memcached]

extension = memcached.so

# 重啟 nginx 和 php

systemctl restart nginx

/etc/init.d/php-fpm restart

# 或kill -9 $(pidof php-fpm)

/usr/local/php/sbin/php-fpm

/usr/local/nginx/sbin/nginx -s reload

# 驗證

/usr/local/php/bin/php -m |

grep memcached

搞定!

附:編譯安裝 php memcache 擴充套件

cd /usr/local/src

git clone memcache

cd memcache

# 編譯安裝

phpize

./configure --with-php-config=/usr/local/php/bin/php-config

make

&&make

install

# 配置

echo

"[memcache]"

>> /usr/local/php/etc/php.ini

echo

"extension = memcache.so"

>> /usr/local/php/etc/php.ini

# 重啟

systemctl restart nginx

/etc/init.d/php-fpm restart

CentOS 下安裝編譯安裝MeMcached

tar xvf memcached 1.4.15.tar.gz cd memcached 1.4.15 configure prefix usr local memcache 出現了 configure error libevent is required.you can get it from t...

PHP的編譯安裝

php編譯安裝 cd usr local src wget tar jxvf php 5.5.26.tar.bz2 cd php 5.5.26 configure with config file path usr local php etc with mysql usr local mysql 說...

PHP 編譯安裝PHP

1.安裝php所有的依賴軟體包 root web01 yum install zlib devel libxml2 devel libjpeg devel freetype devel libpng devel gd devel libcurl devel libxslt devel openssl...