亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    怎么安裝php zookeeper擴展

    安裝方法:1、安裝并啟動zookeeper服務器;2、下載zookeeper擴展,并解壓到PHP安裝目錄的ext目錄下;3、在php安裝目錄下,執(zhí)行命令生成configure和makefile;4、使用make命令編譯安裝即可。

    怎么安裝php zookeeper擴展

    本教程操作環(huán)境:centos6.4系統(tǒng)、PHP5.5.10版,DELL G3電腦

    ZooKeeper是一個分布式的,開放源碼的分布式應用程序協(xié)調(diào)服務,是Google的Chubby一個開源的實現(xiàn),是Hadoop和Hbase的重要組件。它是一個為分布式應用提供一致性服務的軟件,提供的功能包括:配置維護、域名服務、分布式同步、組服務等。

    ZooKeeper的目標就是封裝好復雜易出錯的關鍵服務,將簡單易用的接口和性能高效、功能穩(wěn)定的系統(tǒng)提供給用戶。

    要在php中使用zookeeper,先要安裝php zookeeper擴展,要安裝php zookeeper擴展,得先安裝zookeeper

    安裝php zookeeper擴展的方法

    環(huán)境:

    centos : 6.4

    zookeeper : 3.4.5

    php : 5.5.10

    nginx : 1.5

    php zookeeper擴展 :0.2.2

    如果沒有安裝nginx,先安裝nginx;確保先把nginx配置好,再往下

    如果沒有安裝php,先安裝php(先把nginx的php支持配置好了之后,再去安裝zookeeper的擴展)

    安裝zookeeper

    下載

    wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz

    解壓(隨便你放在哪個目錄,記得就行)

    tar zxfv zookeeper-3.4.5.tar.gz

    啟動zookeeper服務器

    cd zookeeper-3.4.5/conf cp zoo_sample.cfg zoo.cfg cd ../bin ./zkServer.sh start

    這里最好確認一下是否期待成功,./zkServer.sh status

    我這里是單臺,所以結(jié)果為:

    [root@localhost bin]# ./zkServer.sh status JMX enabled by default Using config: /root/zookeeper-3.4.5/bin/../conf/zoo.cfg Mode: standalone

    編譯zookeeper庫,給php用的

    cd ../src/c ./configure --prefix=/usr/local/zookeeperlib make && make install

    安裝php的zookeeper擴展

    下載

    wget http://pecl.php.net/get/zookeeper-0.2.2.tgz

    解壓(解壓出來的package.xml不用去管他)

    tar zxvf zookeeper-0.2.2.tgz

    把他放到/root/php-5.5.10/ext中

    mv zookeeper-0.2.2 /root/php-5.5.10/ext/ cd /root/php-5.5.10/ext/

    改目錄名字

    mv zookeeper-0.2.2 zookeeper

    回到php-5.5.10目錄

    cd .. ./buildconf --force ./configure -h|grep zookeeper

    查看configure是否已經(jīng)支持了zookeeper

    --enable-zookeeper               Enable zookeeper support --disable-zookeeper-session      Disable zookeeper session handler support --with-libzookeeper-dir=DIR   Set the path to libzookeeper install prefix.

    如果顯示如上,說明已經(jīng)支持了,繼續(xù)往下

    cd ext/zookeeper

    生成configure

    /usr/local/php5.5.10/bin/phpize

    生成makefile

    ./configure --with-php-config=/usr/local/php5.5.10/bin/php-config  --with-libzookeeper-dir=/usr/local/zookeeperlib 注意上面的路徑: --with-php-config是php安裝的路徑 --with-libzookeeper-dir是第一步中install zookeeper庫的路徑

    編譯安裝

    make && make install

    結(jié)果為,這個結(jié)果接下來的配置要用到

    Installing shared extensions:     /usr/local/php5.5.10/lib/php/extensions/no-debug-non-zts-20121212/

    添加ext路徑和文件名

    vim /usr/local/php5.5.10/etc/php.ini   extension_dir="/usr/local/php5.5.10/lib/php/extensions/no-debug-non-zts-20121212/" extension=zookeeper.so

    重新編譯php

    進入Php的源碼文件夾,不要進錯了。我的源碼文件夾是/root/php-5.5.10,安裝目錄是/usr/local/php5.5.10

    cd /root/php-5.5.10 rm -rf autom4te.cache/ configure ./buildconf --force ./configure -h|grep zookeeper

    查看configure是否已經(jīng)支持了zookeeper

    如果已經(jīng)支持了,繼續(xù)往下

    ./configure --prefix=/usr/local/php5.5.10 --with-config-file-path=/usr/local/php5.5.10/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-zookeeper --with-libzookeeper-dir=/usr/local/zookeeperlib --enable-sockets
     make && make install

    到這里,已經(jīng)安裝好支持了,來測試下是否正常

    在zookeeper-0.2.2.tgz中(也就是Php的zookeeper擴展),有examples/Zookeeper_Example.php文件,可以用來測試

    cp /root/php-5.5.10/ext/zookeeper/examples/Zookeeper_Example.php /usr/local/nginx/html/ /usr/local/php5.5.10/bin/php /usr/local/nginx/html/Zookeeper_Example.php

    看是否能打印出如下結(jié)果

    string(0) "" array(1) {   [0]=>   string(9) "zookeeper" } NULL string(3) "abc" array(2) {   [0]=>   string(7) "test123"   [1]=>   string(9) "zookeeper" } NULL NULL array(2) {   [0]=>   string(3) "001"   [1]=>   string(3) "002" }

    重啟php-fpm

    killall php-fpm /usr/local/php5.5.10/sbin/php-fpm

    現(xiàn)在就可以通過瀏覽器訪問支持zookeeper擴展的php了

    如果還有別的問題,請檢查:

    1、iptables

    2、selinux

    推薦學習:《PHP視頻教程》

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號