国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > CentOS > 正文

CentOS(x86_64)下PHP安裝memcache擴展問題解決方法分享

2020-06-21 13:12:15
字體:
供稿:網(wǎng)友
系統(tǒng)版本是5.2,把安裝memcached的方法記錄下先:

復(fù)制代碼
代碼如下:

cd ~/memcached
wget -c http://www.monkey.org/~provos/libevent-1.4.10-stable.tar.gz
wget -c http://memcached.googlecode.com/files/memcached-1.2.8.tar.gz
#安裝libevent
tar -zxvf libevent-1.4.10-stable.tar.gz
cd libevent-1.4.10-stable
./configure
make
make install
#安裝memcached
cd ..
tar -zxvf memcached-1.2.8.tar.gz
cd memcached-1.2.8
./configure
make
make install
#如果是64位系統(tǒng),還需要把libevent的文件復(fù)制到/wp-content/lib64/下,用來解決error while loading shared libraries的問題
cp -R /wp-content/local/lib/libevent* /wp-content/lib64/


好了,開始安裝php的擴展,惡夢開始了,本以為直接用yum來安裝php-devel.x86_64和php-pecl-memcache.x86_64這兩個擴展就可以了,可裝了后 phpinfo()里根本找不到memcache擴展,把已經(jīng)裝的這兩個擴展remove重來,還是不行,goooooooooooooogle,找到了一篇文章《PHP Pecl Memcached module installation problems》,有救嘍,先remove掉php-pecl-memcache.x86_64,然后執(zhí)行了

pecl install memcache

順利安裝上了,打開/etc/php.d/看了下,沒有memcache.ini,好吧,手動到/etc/php.ini加上了 extension=memcache.so,好了,重啟httpd,刷新 phpinfo() ,竟然還沒有,我郁悶了。。

回頭想想,我好像漏了一個地方?jīng)]有檢查,馬上打開 /wp-content/lib64/php/modules/ 查看,果然沒有memcache.so,會在哪呢? find -name之,原來躲在 /wp-content/local/lib/php/extensions/no-debug-non-zts-20060613/ 下,復(fù)制到 /wp-content/lib64/php/modules/ 再試,久違的 memcache擴展出現(xiàn)了。 T T

CentOS,memcache

Memcached參數(shù)說明:

  • -d選項是啟動一個守護進程
  • -m分配給Memcache使用的內(nèi)存數(shù)量,單位是MB
  • -u運行Memcache的用戶
  • -l監(jiān)聽的服務(wù)器IP地址
  • -p設(shè)置Memcache監(jiān)聽的端口,最好是1024以上的端口
  • -c最大運行的并發(fā)連接數(shù),默認(rèn)是1024,按照你服務(wù)器的負(fù)載量來設(shè)定
  • -P設(shè)置保存Memcache的pid文件

啟動:

memcached -d -u root -m 128 -c 8192

查看狀態(tài):

watch “echo stats | nc 127.0.0.1 11211″

CentOS,memcache

狀態(tài)說明:

  • uptime:memcached運行的秒數(shù)
  • cmd_get:查詢緩存的次數(shù)。這兩個數(shù)據(jù)相除一下就能得到平均每秒請求緩存的次數(shù)
  •  
  • cmd_set:設(shè)置key=>value的次數(shù)
  • get_hits:緩存命中的次數(shù)。緩存命中率 = get_hits/cmd_get * 100%
  • scurr_items:現(xiàn)在在緩存中的鍵值對個數(shù)

相關(guān)網(wǎng)址:

Libevent:http://www.monkey.org/~provos/libevent/
Memcached:http://danga.com/memcached/
PHP Memcached Extension:http://pecl.php.net/package/memcache


[shell]
[root@~]# pecl install memcache
downloading memcache-2.2.6.tgz ...
Starting to download memcache-2.2.6.tgz (35,957 bytes)
..........done: 35,957 bytes
11 source files, building
WARNING: php_bin /opt/php/bin/php appears to have a suffix /bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Enable memcache session handler support? [yes] : n
[/shell]

[shell]
running: make INSTALL_ROOT="/var/tmp/pear-build-root/install-memcache-2.2.6" install
Installing shared extensions: /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions/no-debug-non-zts-20090626/
running: find "/var/tmp/pear-build-root/install-memcache-2.2.6" | xargs ls -dils
11370548 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6
11370602 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt
11370603 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php
11370604 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib
11370605 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php
11370606 4 drwxr-xr-x 3 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions
11370607 4 drwxr-xr-x 2 root root 4096 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions/no-debug-non-zts-20090626
11370601 236 -rwxr-xr-x 1 root root 235639 Jan 6 15:55 /var/tmp/pear-build-root/install-memcache-2.2.6/opt/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so

Build process completed successfully
Installing '/opt/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so'
install ok: channel://pecl.php.net/memcache-2.2.6
configuration option "php_ini" is not set to php.ini location
You should add "extension=memcache.so" to php.ini
[/shell]
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 枝江市| 朝阳区| 大兴区| 鹤庆县| 克山县| 中西区| 临西县| 云阳县| 平阳县| 汪清县| 买车| 咸宁市| 丰台区| 寿光市| 德兴市| 聂拉木县| 留坝县| 成都市| 泽普县| 宝清县| 岫岩| 临清市| 郯城县| 西昌市| 青铜峡市| 台南市| 阜城县| 马鞍山市| 蛟河市| 邵武市| 旬阳县| 达拉特旗| 长治市| 周至县| 磴口县| 子洲县| 蓬安县| 双鸭山市| 扶风县| 运城市| 萨迦县|