Centos7安裝gearman和php擴展

Centos7安裝gearman和php擴展

標籤(空格分隔): php,linuxphp

gearman所須要的依賴

yum install \
    vim \
    git \
    gcc \
    gcc-c++ \
    wget \
    make \
    gperf \
    automake \
    autoconf \
    boost-devel \
    libuuid-devel \
    libevent-devel \
    -y \

安裝gearmand

cd /root
    wget https://github.com/gearman/gearmand/releases/download/1.1.17/gearmand-1.1.17.tar.gz
    tar -zxvf gearmand-1.1.17.tar.gz
    cd gearmand-1.1.17
    ./configure \
    --prefix=/usr/local/gearman/ \
    --disable-libpq \
    --disable-hiredis \
    --disable-libdrizzle \
    --disable-silent-rules \
    --disable-libtool-lock \
    --disable-libmemcached \
    --disable-option-checking \
    --disable-libtokyocabinet \
    --disable-dependency-tracking \
    make
    make install

建立gearman用戶

useradd -s /sbin/nologin -M gearman
mkdir /usr/local/gearman/var/
mkdir /usr/local/gearman/var/log/
chown -R gearman:gearman /usr/local/gearman/

啓動gearman並設置開機啓動linux

# 進入單元文件目錄
cd /etc/systemd/system

# 建立redis單元文件,格式爲: [單元文件名].[單元文件類型]
vim gearman.service

[Unit]
Description=Start gearman on boot.
After=default.target network.target

[Service]
User=gearman
Group=gearman
Type=forking
PIDFile=/usr/local/gearman/var/log/gearmand.pid
ExecStart=/usr/local/gearman/sbin/gearmand --log-file=/usr/local/gearman/var/log/gearmand.log --pid-file=/usr/local/gearman/var/log/gearmand.pid -d
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=false
Restart=always

[Install]
WantedBy=multi-user.target

ESC
:wqc++

修改文件權限爲只有root用戶能夠編輯該文件

chown -R root:root /etc/systemd/system/gearman.service
chmod -R 644 /etc/systemd/system/gearman.service

更新systemd

systemctl daemon-reload
systemctl enable gearman
systemctl start gearman

安裝php擴展

yum install libgearman-devel -y
cd ~
wget https://github.com/wcgallego/pecl-gearman/archive/gearman-2.0.3.tar.gz
tar -zxvf gearman-2.0.3.tar.gz
cd pecl-gearman-gearman-2.0.3
phpize
./configure
make
make install
修改php.ini

vim /usr/local/gearman/php-7.0.13/lib/php.ini

extension=gearman.so

ESCgit

相關文章
相關標籤/搜索