Linux 上安裝Gearman及其PHP擴展

安裝Gearman服務端php

  1. # yum install -y uuid-devel libuuid libuuid-devel uuid boost-devel libevent libevent-devel gperf
  2. # wget https://launchpad.net/gearmand/1.2/1.1.7/+download/gearmand-1.1.7.tar.gz
  3. # tar zxvf gearmand-1.1.7.tar.gz
  4. # cd gearmand-1.1.7
  5. # ./configure --prefix=/usr/local/server/gearmand-1.1.7
  6. # make && make install
  7. # ln -s /usr/local/server/gearmand-1.1.7 /usr/local/server/gearmand

啓動Gearman服務端:html

# /usr/local/server/gearmand-1.1.7/sbin/gearmand -dphp-fpm

  • -b,--backlog= 儲備的監聽鏈接數量
  • -d, --daemon 後臺運行
  • -f, --file-descriptors= 文件描述符的數量
  • -h, --help 幫助
  • -j, --job-retries= 在ob server移除不可用job以前運行的次數,防止不斷運行致使其餘可用worker崩潰。默認沒有限制
  • -l, -log-file= 日誌文件存放位置(默認記錄最簡單日誌)
  • -L, --listen= 監聽的IP,默認所有接受
  • -p, --port= 指定監聽端口
  • -P, --pid-file= 指定進程ID寫入位置
  • -r, --protocol= 加載協議模塊
  • -q, --queue-type= 指定持久化隊列
  • -t, --threads= 使用的I/9線程數量。默認爲0
  • -u, --user= 啓動後,切換到指定用戶
  • -v, --verbose 增長一級詳細程度
  • -V, --version 顯示版本信息

出現Could not open log file這種錯誤,須要使用--log-file指定日誌文件ui

安裝PHP擴展.net

  1. # wget http://pecl.php.net/get/gearman-1.1.1.tgz
  2. # tar zxvf gearman-1.1.1.tgz
  3. # cd gearman-1.1.1
  4. # /usr/local/server/php/bin/phpize
  5. # ./configure --with-php-config=/usr/local/server/php/bin/php-config --with-gearman=/usr/local/server/gearmand-1.1.7/
  6. # make && make install

上述步驟會輸出擴展安裝目錄:/usr/local/server/php-5.4.14/lib/php/extensions/no-debug-non-zts-20100525/
修改php.ini,如下加入語句加入:
extension=/usr/local/server/php-5.4.14/lib/php/extensions/no-debug-non-zts-20100525/gearman.so線程

重啓php-fpm,用phpinfo查看是否安裝成功
# service php-fpm restartdebug

 

Note:rest

安裝PHP擴展時候,有可能由於版本問題致使安裝失敗。因此最好去官網看下最新版本。日誌

 

轉自:http://www.williamsang.com/archives/966.htmlserver

相關文章
相關標籤/搜索