1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務時間:8:30-17:00
      你可能遇到了下面的問題
      關閉右側工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      Centos安裝Gearman及其php擴展-創(chuàng)新互聯(lián)

      安裝Gearman

      專注于為中小企業(yè)提供做網(wǎng)站、網(wǎng)站制作服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)臨邑免費做網(wǎng)站提供優(yōu)質的服務。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設實現(xiàn)規(guī)模擴充和轉變。

      ========================================================

      向一個機器添加Gearman需要兩步:

      1.構建并啟動這個守護進程(gearmand)

      2.構建與php版本相匹配的PHP擴展。

      ========================================================

      安裝gearmand

      ========================================================

      我安裝版本是gearmand 1.1.12:

      1. 首先安裝依賴包:

      sudo yum -y install autoconf bison flex libtool libboost-all-dev libcurl4-openssl-dev curl libevent-dev uuid-dev libsqlite3-dev libmysqlclient-dev mysql-devel

      2.下載Gearmand版本

      在https://launchpad.net/gearmand下載最新版本

      3.解壓、編譯、安裝源碼包

      tar xvzf gearmand-1.1.12.tar.gz
      cd gearmand-1.1.12
      ./configure
      make
      make install

      注:這個過程中可能無法編譯成功,而且?guī)茁屎艽螅野惭b的時候出現(xiàn)各種問題,但主要都是缺少共享庫,這時候要根據(jù)個人實際情況,看它報的是什么錯,然后根據(jù)報錯,更新或者安裝共享庫。

      sudo yum install ***等。

      4.為大多數(shù)最新的共享庫創(chuàng)建必須的鏈接和緩存。其中可能報:

      error: gearman: error while loading shared libraries: libgearman.so.8: cannot open shared object file: No such file or directory

      解決辦法:sudo ldconfig,我安裝的時候就出現(xiàn)了這種情況,一開始不知道怎么回事,百度了很久才找到這個方法。

      安裝php 的gearman 擴展

      ========================================================

      下載最新版本:

      $ wget http://pecl.php.net/get/gearman-1.1.1.tgz
      $ tar zxvf gearman-1.1.1.tgz
      $ cd gearman-1.1.1/
      $ phpize

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

      $ make
      $ make install

      6. 在php.ini文件末尾添加"extension=gearman.so"

      7. 檢測擴展是否安裝成功

      $ php --info | grep "gearman support"
      gearman support => enabled

      顯示出:gearman support => enabled,就表示安裝成功啦。

      測試

      ========================================================

      1)sudo ldconfig

      2)啟動gearmand: gearmand -d &

      這一步可能會遇到:

      啟動這個 agent,即 Gearman 守護程序:
      /usr/local/sbin/gearmand --daemon
      報錯:Could not open log file "/usr/local/var/log/gearmand.log", from "/usr/sbin", switching to stderr. (No such file or directory)
      解決:
      mkdir -p /usr/local/var/log/
      cd /usr/local/var/log/
      touch gearmand.log
      再次嘗試啟動:
      /usr/local/sbin/gearmand --daemon
      成功運行.查看進程:ps -ef | grep gearmand
      root   19390   1  0 17:50 ?     00:00:00 gearmand --daemon
      root   19403   1  0 17:54 ?     00:00:00 /usr/local/sbin/gearmand --daemon
      root   19406  1556  0 17:54 pts/3   00:00:00 grep gearmand

      3)查看gearmand是否在運行:ps aux | grep [g]earmand

      4)檢查germand的任務檢測端口4730:sudo lsof -i tcp:4730

      例子:從PHP使用Gearman

      =====================================================

      從 PHP 使用 Gearman 類似于之前的示例,惟一的區(qū)別在于這里是在 PHP 內(nèi)創(chuàng)建 producer 和 consumer。
      每個 consumer 的工作均封裝在一個或多個 PHP 函數(shù)內(nèi)。
      先用 PHP 編寫的一個 Gearman worker。將這些代碼保存在一個名為 worker.php 的文件中。
       $worker= new GearmanWorker();
       $worker->addServer();
       $worker->addFunction("title", "title_function");
       while ($worker->work());

       function title_function($job)
       {
        return ucwords(strtolower($job->workload()));
       }
      ?>

      再用 PHP 編寫的一個 producer,或 client。將此代碼保存在一個名為 client.php 的文件內(nèi)。
       $client= new GearmanClient();
       $client->addServer();
       print $client->do("title", "All The World's a stage!");
       print "\n";
      ?>

      現(xiàn)在,可以用如下的命令行連接客戶機與 worker 了:
      php worker.php &
      php client.php
      結果:
      All The World's a stage!

      另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。


      網(wǎng)站標題:Centos安裝Gearman及其php擴展-創(chuàng)新互聯(lián)
      瀏覽路徑:http://www.ef60e0e.cn/article/diheoh.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        英山县| 青河县| 和田县| 昆山市| 阿拉善左旗| 泽普县| 贵州省| 读书| 克什克腾旗| 迁安市| 衡阳县| 吉安县| 加查县| 福贡县| 泰和县| 阿瓦提县| 增城市| 平遥县| 辽中县| 贡嘎县| 南部县| 水富县| 收藏| 龙门县| 昌江| 都安| 德州市| 德保县| 岳阳县| 大化| 聂荣县| 太湖县| 威宁| 孟津县| 竹山县| 峨山| 柳州市| 兴山县| 武功县| 锡林郭勒盟| 竹山县|