努力挣扎的生活 努力挣扎的生活
  • 前端文章

    • JavaScript
  • 学习笔记

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • 运维基础
  • 监控
  • 日志系统
  • gitlab安装
  • jenkins安装和管理
  • Jenkins工具集成
  • pipeline流水线
  • Docker
  • Kubernetes
  • Nexus
  • Rancher
  • Prometheus
  • ELK(EFK)
  • 虚拟化
  • Mysql
  • PostgreSQL
  • Redis
  • MongoDB
  • clickhouse
关于
  • 分类
  • 标签
  • 归档
  • 收藏
  • 更多
GitHub (opens new window)

yangfk

瑟瑟发抖的小运维
  • 前端文章

    • JavaScript
  • 学习笔记

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • 运维基础
  • 监控
  • 日志系统
  • gitlab安装
  • jenkins安装和管理
  • Jenkins工具集成
  • pipeline流水线
  • Docker
  • Kubernetes
  • Nexus
  • Rancher
  • Prometheus
  • ELK(EFK)
  • 虚拟化
  • Mysql
  • PostgreSQL
  • Redis
  • MongoDB
  • clickhouse
关于
  • 分类
  • 标签
  • 归档
  • 收藏
  • 更多
GitHub (opens new window)
  • 运维基础

    • nginx 安装
    • nginx-conf常用示例
    • rsync 服务pull与push
    • linux时间同步
    • 系统参数优化
    • ruby版本升级
    • fpm定制rpm
    • php7_X安装
      • 源码安装 7.2.6
        • 通过shell脚本快速安装
        • 启动服务
        • php7.4.20安装
        • php.ini常用配置修改
        • php-fpm.conf 常用配置修改
      • PHP 常用扩展模块
        • 查看 php 扩展
      • 个人存储下载地址。。。
    • iptables规则
    • tcpdump抓包
    • 公司部署Pritunl-VPN
    • 需求shell脚本记录
    • openldap安装配置
    • Ldap集成常用开源服务示例图
    • ansible基础
    • ansible进阶playbook与Roles
    • centos安装python3
    • Firewalld防火墙
    • Linux配置jdk
    • ubuntu安装ftp
    • minio分布式文件存储
    • windows安装openssh
    • centos7安装系统检测不到网卡
    • docker运行一个bind9和常用的网络命令
    • nginx禁用真实IP
  • 监控

  • 日志系统

  • 安全记录

//
  • 运维
  • 运维基础
yangfk
2019-09-05

php7_X安装

//

# 源码安装 7.2.6

官方地址手🤞🤞 (opens new window)

# 通过shell脚本快速安装

php_7.2.6.sh 脚本内容

#!/bin/bash

auther: yangfk
#注意:脚本和tar包在一个目录下面,没有会自动下载,速度稍微慢一点点
read -p "默认的php安装路径在/usr/local,需要修改吗?注意:修改请输入绝对路径  " path

if [ ! -z ${path} ];then
Dir=${path}
        echo "你的php安装路径在 ${Dir} "
else
Dir=/usr/local
fi
sleep 2

Path=$(cd $(dirname $0); pwd)
IPAddr=$(ifconfig eth0|awk 'NR==2{print $2}')


#编译工具准备
 yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel  krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

yum install -y gmp-devel readline-devel sqlite-devel 
#译安装re2c/bison/limcrypt
#之前我们已经安装了 gcc 、 automake 、 autoconf 等,还需要 re2c 和 bison 这两个。这两个都是 PHP 的语法分析器,两者的下载地址:
#下载re2c源码包
cd ${Path}
if [ ! -e re2c-0.15.3.tar.gz ];then
wget http://sourceforge.net/projects/re2c/files/0.15.3/re2c-0.15.3.tar.gz && tar xf ${Path}/re2c-0.15.3.tar.gz
cd ${Path}/re2c-0.15.3
 ./configure && make && make install
else
tar xf ${Path}/re2c-0.15.3.tar.gz
cd ${Path}/re2c-0.15.3
 ./configure && make && make install
 fi

#下载BSION源码包
cd ${Path}
if [ ! -e bison-3.0.4.tar.gz ];then
wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz && tar xf ${Path}/bison-3.0.4.tar.gz
cd ${Path}/bison-3.0.4
./configure && make && make install
else
tar xf ${Path}/bison-3.0.4.tar.gz
cd ${Path}/bison-3.0.4
./configure && make && make install
fi


#下载libmcrypt 源码包
cd ${Path}
if [ ! -e libmcrypt-2.5.7.tar.gz ];then
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz && tar xf ${Path}/libmcrypt-2.5.7.tar.gz
cd ${Path}/libmcrypt-2.5.7
./configure && make && make install
else
tar xf ${Path}/libmcrypt-2.5.7.tar.gz
cd ${Path}/libmcrypt-2.5.7
./configure && make && make install
fi

#手动执行第三条yum命令
yum install -y  libxslt-devel sqlite-devel  openssl openssl-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel

#下载PHP7的安装包
cd ${Path}
if [ ! -e php-7.2.6.tar.gz ]
then
	        wget -O php-7.2.6.tar.gz http://cn2.php.net/get/php-7.2.6.tar.gz/from/this/mirror && tar xf ${Path}/php-7.2.6.tar.gz -C ${Path}
			if [ $? -ne 0 ];then
				echo "检查${Path}/php-7.2.6.tar.gz ,下载失败"
				exit 1
			fi
        	cd ${Path}/php-7.2.6

			yum install -y  libxslt-devel sqlite-devel openssl openssl-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel


            #php编译参数
            ./configure --prefix=${Dir}/php/ --with-config-file-path=${Dir}/php/etc --with-config-file-scan-dir=${Dir}/php/etc/conf.d \
            --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-soap --with-openssl --with-openssl-dir --with-pcre-regex --with-zlib --with-iconv \
            --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --with-pcre-dir --enable-ftp --enable-bcmath --with-gd --with-jpeg-dir \
            --with-png-dir --with-freetype-dir --with-gettext  --enable-ctype --with-gmp --with-mhash --enable-mbstring --with-libmbfl --with-onig --enable-pdo \
            --with-pdo-mysql --with-zlib-dir --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem \
            --enable-sysvshm --enable-mbregex --enable-inline-optimization --enable-wddx --with-libxml-dir --with-xsl --enable-libxml --enable-xml --enable-zip \
            --enable-mysqlnd --enable-pcntl --with-mysqli --with-xmlrpc --without-pear --enable-opcache

        if [ $? != 0 ];then
                echo "php 编译失败,检查报错是否缺少依赖,请再次执行尝试,或者手动执行第三条yum命令"
        exit 2
        fi
else
            tar xf php-7.2.6.tar.gz
            cd ${Path}/php-7.2.6
            yum install -y  libxslt-devel  openssl openssl-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel

            #php编译参数
            ./configure --prefix=${Dir}/php/ --with-config-file-path=${Dir}/php/etc --with-config-file-scan-dir=${Dir}/php/etc/conf.d \
            --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-soap --with-openssl --with-openssl-dir --with-pcre-regex --with-zlib --with-iconv \
            --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --with-pcre-dir --enable-ftp --enable-bcmath --with-gd --with-jpeg-dir \
            --with-png-dir --with-freetype-dir --with-gettext  --enable-ctype --with-gmp --with-mhash --enable-mbstring --with-libmbfl --with-onig --enable-pdo \
            --with-pdo-mysql --with-zlib-dir --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem \
            --enable-sysvshm --enable-mbregex --enable-inline-optimization --enable-wddx --with-libxml-dir --with-xsl --enable-libxml --enable-xml --enable-zip \
            --enable-mysqlnd --enable-pcntl --with-mysqli --with-xmlrpc --without-pear --enable-opcache
        if [ $? != 0 ];then
                echo 'php 编译失败,检查报错是否缺少依赖,请再次执行尝试,或者手动执行第三条yum命令'
        exit 3
        fi
fi

#编译
make -j $(nproc) && make install
        if [ $? != 0 ]
        then
                echo "php make 编译失败,请检查报错"
        exit 4
        fi

#复制php配置文件到安装目录

cp ${Path}/php-7.2.6/php.ini-production ${Dir}/php/etc/php.ini
#删除系统自带配置文件
rm -rf /etc/php.ini
#添加软链接到 /etc目录
ln -s ${Dir}/php/etc/php.ini /etc/php.ini
#拷贝模板文件为php-fpm配置文件
cp ${Dir}/php/etc/php-fpm.conf.default ${Dir}/php/etc/php-fpm.conf
#添加软连接到 /etc目录
ln -s ${Dir}/php/etc/php-fpm.conf /etc/php-fpm.conf

#php-fpm.conf 进行相应修改
cat >/etc/php-fpm.conf<<OPO
[global]
pid = ${Dir}/php/var/run/php-fpm.pid
error_log = /opt/logs/php-fpm.log
log_level = error
emergency_restart_threshold = 60
emergency_restart_interval = 60s
process_control_timeout = 5s
daemonize = yes

[www]
listen = 127.0.0.1:9000
listen.backlog = 8192
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = static
pm.max_children = 400
pm.max_requests = 10240
pm.status_path = /_php_fpm_status_
request_terminate_timeout = 30s
request_slowlog_timeout = 3s
slowlog = /opt/logs/php-fpm.log.slow
rlimit_files = 65535
rlimit_core = 65535
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
OPO

#配置日志目录
[ -d /opt/logs ] || mkdir -p /opt/logs

#调整服务器的文件数限制
ulimit -SHn 65536

#永久生效
grep 6553 /etc/security/limits.conf
if [ $? -ne 0 ];then
cat >>/etc/security/limits.conf<<OPPO
*       soft    nofile  65536
*       hard    nofile  65536
*       soft    nproc  65536
*       hard    nproc  65536
OPPO
ulimit -a
else
	echo '已经修改文件描叙符'
fi


#创建运行用户
id www
if [ $? -ne 0 ];then
	groupadd www
	useradd -s /sbin/nologin -g www -M www
fi

#设置 php-fpm开机启动
#拷贝php-fpm到启动目录
cp ${Path}/php-7.2.6/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
test -f ${Dir}/php/bin/php-fpm || cp ${Path}/php-7.2.6/sapi/fpm/init.d.php-fpm ${Dir}/php/bin/php-fpm
#添加执行权限
chmod +x /etc/rc.d/init.d/php-fpm
#设置开机启动
chkconfig php-fpm on

#编辑配置文件
#sed -i 's#disable_functions =#disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname#g' ${Dir}/php/etc/php.ini
sed -i 's#;date.timezone =#date.timezone = PRC#g' ${Dir}/php/etc/php.ini
sed -i 's#expose_php = On#expose_php = Off#g' ${Dir}/php/etc/php.ini
sed -i 's#;opcache.enable=1#opcache.enable=1#g' ${Dir}/php/etc/php.ini
sed -i 's#;opcache.enable_cli=0#opcache.enable_cli=0#g' ${Dir}/php/etc/php.ini
echo 'zend_extension=opcache.so'>>${Dir}/php/etc/php.ini


echo "export PATH=${Dir}/php/bin:\$PATH" >> /etc/profile
echo "export PATH=${Dir}/php/sbin:\$PATH" >> /etc/profile

ln -s ${Dir}/php/sbin/* ${Dir}/sbin/
ln -s ${Dir}/php/bin/* ${Dir}/bin/
#启动 php-fpm
cp ${Dir}/php/etc/php-fpm.d/www.conf.default ${Dir}/php/etc/php-fpm.d/www.conf
echo "service php-fpm start启动"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221

# 启动服务

source /etc/profile #加载环境变量
service php-fpm start

#检查端口:9000
netstat -tnlp

1
2
3
4
5
6

# php7.4.20安装

#配置repo源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum makecache

#下载把php包版本7.4.20
 wget http://download.yfklife.cn/blog/ops/php/php-7.4.20.tar.gz
 wget http://download.yfklife.cn/blog/ops/php/php_7.4.20.sh
 bash php_7.4.20.sh
1
2
3
4
5
6
7
8

# php.ini常用配置修改

log_errors = On  #开启日志
max_execution_time = 30  #php执行时长
post_max_size = 8M       #php上传文件最大限制
file_uploads = On        #是否允许上传文件
upload_max_filesize = 2M #限制PHP处理上传文件的最大值,此值必须小于post_max_size值 
max_file_uploads = 20    #上传文件数限制
date.timezone = PRC      #时区
cgi.fix_pathinfo=1       #nginx PATH_INFO路径匹配相关,默认即可
1
2
3
4
5
6
7
8

# php-fpm.conf 常用配置修改

[global]
 pid = /usr/local/php/var/run/php-fpm.pid
 error_log = /opt/logs/php-fpm.log
 log_level = error
 emergency_restart_threshold = 60
 emergency_restart_interval = 60s
 process_control_timeout = 5s
 daemonize = yes
 [www]
 listen = 127.0.0.1:9000
 listen.backlog = 8192
 listen.owner = www
 listen.group = www
 listen.mode = 0666
 user = www
 group = www
 pm = static
 pm.max_children = 300
 pm.max_requests = 10240
 pm.status_path = /php_fpm_status
 request_terminate_timeout = 30s
 request_slowlog_timeout = 3s
 slowlog = /opt/logs/php-fpm.log.slow
 rlimit_files = 65535
 rlimit_core = 65535
 catch_workers_output = yes
 env[HOSTNAME] = basic
 env[PATH] = /usr/bin:/bin
 env[TMP] = /tmp
 env[TMPDIR] = /tmp
 env[TEMP] = /tmp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

# PHP 常用扩展模块

更多模块下载地址点击手🤞🤞 (opens new window)

#!/bin/bash

echo 'php的模块安装开始'

ping -c 1 223.5.5.5 &>/dev/null
if [ $? -ne 0 ];then
	echo "请检查网路"
	exit 10
else
	echo "正常网络"
fi

Path=$(cd $(dirname $0); pwd)
PHP=$(which php)
PHP_dir=$(dirname $(which php))
yum install unzip gcc gcc-c++ autoconf automake openssl-devel libmcrypt-devel cyrus-sasl*  -y


#redis模块安装
redis() {
$PHP -m |grep redis
if [ $? != 0 ];then
	if [ -d ${Path}/redis-3.1.2 ];then
		echo "目录已经存在"
	else

		cd ${Path} && tar xf ${Path}/redis-3.1.2.tgz -C ${Path}
	fi


cd ${Path}/redis-3.1.2
${PHP_dir}/phpize
./configure --with-php-config=${PHP_dir}/php-config
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install

cat >>/etc/php.ini<<OPO
extension=redis.so
OPO

else
  echo "redis module exsit"
fi

}

#mcrypt模块安装
mcrypt() {
$PHP -m |grep -w  mcrypt
if [ $? != 0 ];then
if [ -e ${Path}/mcrypt-1.0.3.tar ];then
    echo 'mcrypt-1.0.3.tar存在'
else
    cd ${Path} && wget http://pecl.php.net/get/mcrypt-1.0.3.tgz
fi

if [ -d ${Path}/mcrypt-1.0.3 ];then
    echo "mcrypt-1.0.3目录已经存在"
else

    cd ${Path} && tar xf ${Path}/mcrypt-1.0.3.tar
fi


cd ${Path}/mcrypt-1.0.3
${PHP_dir}/phpize

./configure --with-php-config=${PHP_dir}/php-config
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install

cat >>/etc/php.ini<<OPO
extension=mcrypt.so
OPO

else
  echo "mcrypt module exsit"
fi

}

#memcache模块安装

memcache() {
$PHP -m |grep -w  memcache
if [ $? != 0 ];then
if [ -e ${Path}/php7.zip ];then
	echo 'php7.zip存在'
else
	cd ${Path} && wget https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
fi

if [ -d ${Path}/pecl-memcache-php7 ];then
	echo "pecl-memcache-php7目录已经存在"
else

	cd ${Path} && unzip ${Path}/php7.zip
fi


cd ${Path}/pecl-memcache-php7
${PHP_dir}/phpize

./configure --with-php-config=${PHP_dir}/php-config
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install

cat >>/etc/php.ini<<OPO
extension=memcache.so
OPO

else
  echo "memcache module exsit"
fi

}

#memcached模块安装

memcached() {

$PHP -m |grep -w  memcached
if [ $? != 0 ];then

cd ${Path}
if [ -d ${Path}/libmemcached-1.0.18 ];then
	echo "目录已经存在"
else
	if [ -e libmemcached-1.0.18.tar.gz ];then
		cd ${Path} && tar -xf ${Path}/libmemcached-1.0.18.tar.gz  -C ${Path}
	else
		cd ${Path} && wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
		tar -xf ${Path}/libmemcached-1.0.18.tar.gz  -C ${Path}
	fi
fi

cd ${Path}/libmemcached-1.0.18
./configure --prefix=/usr/local/libmemcached --with-memcached
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install


cd ${Path}
if [ -e ${Path}/master.zip ];then
	echo 'php-memcached.zip存在'
else
	cd ${Path} && wget https://github.com/php-memcached-dev/php-memcached/archive/master.zip

fi

if [ -d ${Path}/php-memcached-master ];then
	echo "目录已经存在"
else

	unzip ${Path}/master.zip -d ${Path}
fi


cd ${Path}/php-memcached-master
${PHP_dir}/phpize

./configure --with-php-config=${PHP_dir}/php-config  --with-libmemcached-dir=/usr/local/libmemcached
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install

cat >>/etc/php.ini<<OPO
extension=memcached.so
OPO

else
  echo "memcached module exsit"
fi

}

#ImageMagick模块安装

imagick() {

$PHP -m |grep imagick
if [ $? != 0 ];then
cd ${Path}

if [ -d ${Path}/ImageMagick-7.0.8-21 ];then
        echo "目录已经存在"
else
        if [ -e ${Path}/ImageMagick.tar.gz ];then
                echo 'ImageMagick.tar.gz存在'
        else
                cd ${Path} && wget http://www.imagemagick.org/download/ImageMagick.tar.gz
                tar -xzvf ${Path}/ImageMagick.tar.gz -C  ${Path}
        fi
        cd ${Path} && tar -xzvf ${Path}/ImageMagick.tar.gz -C ${Path}
fi


cd ${Path}/ImageMagick-7.0.8-21
${PHP_dir}/phpize

./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install



if [ -d ${Path}/imagick-3.4.3 ];then
        echo "目录已经存在"
else
        if [ -e ${Path}/imagick-3.4.3.tgz ];then
        cd ${Path} && tar xf ${Path}/imagick-3.4.3.tgz -C ${Path}
        else
        cd ${Path} && wget https://pecl.php.net/get/imagick-3.4.3.tgz
        tar xf ${Path}/imagick-3.4.3.tgz -C ${Path}
fi
fi

cd ${Path}/imagick-3.4.3
${PHP_dir}/phpize

./configure --with-php-config=${PHP_dir}/php-config --with-imagick=/usr/local/imagemagick/
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install

cat >>/etc/php.ini<<OPO
extension=imagick.so
OPO


else
  echo "imagick module exsit"
fi

}

#zookeeper模块安装

zookeeper() {
$PHP -m |grep zookeeper
if [ $? != 0 ];then

if [ -d ${PHP_dir}/zookeeper ];then
	echo "目录已经存在"
else
	if [ -e ${Path}/zookeeper-3.4.12.tar.gz ];then

		cd ${Path} && tar xf ${Path}/zookeeper-3.4.12.tar.gz -C ${Path}

		cd ${Path}/zookeeper-3.4.12/src/c
		./configure -prefix=/usr/local/zookeeper/
		make && make install

	else
		cd ${Path} && wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.12/zookeeper-3.4.12.tar.gz
		cd ${Path} && tar xf ${Path}/zookeeper-3.4.12.tar.gz -C ${Path}

		cd ${Path}/zookeeper-3.4.12/src/c
		./configure -prefix=/usr/local/zookeeper/
		make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install

	fi
fi


if [ -d ${Path}/zookeeper-0.5.0 ];then
	echo "目录已经存在"
else
	cd ${Path} && tar xf ${Path}/zookeeper-0.5.0.tgz -C ${Path}
fi

cd ${Path}/zookeeper-0.5.0
${PHP_dir}/phpize

./configure -with-php-config=${PHP_dir}/php-config -with-libzookeeper-dir=/usr/local/zookeeper
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install

cat >>/etc/php.ini<<OPO
extension=zookeeper.so
OPO

else
  echo "zookeeper module exsit"
fi

}

#安装librdkafka和php-rdkafka

librdkafka() {
$PHP -m |grep -w rdkafka
if [ $? != 0 ];then

  cd ${Path}
  if [ -d ${Path}/librdkafka ];then
  	echo "目录已经存在"
  else
  	if [ -e ${Path}/librdkafka.tar.gz ];then
  	cd ${Path} && tar xf ${Path}/librdkafka.tar.gz -C ${Path}
  	else
  	cd ${Path} && git clone https://github.com/edenhill/librdkafka.git
  	fi
  fi

cd ${Path}/librdkafka

./configure
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install

  if [ -d ${Path}/php-rdkafka ];then
  	echo "目录已经存在"
  else
  	if [ -e ${Path}/php-rdkafka.tar.gz ];then
  	cd ${Path} && tar xf ${Path}/php-rdkafka.tar.gz -C ${Path}
  	else
  	cd ${Path} && git clone https://github.com/arnaud-lb/php-rdkafka.git
  	fi
  fi


cd ${Path}/php-rdkafka
${PHP_dir}/phpize

./configure
make -j$(lscpu |awk '/^CPU\(s/{print $2}') && make install

cat >>/etc/php.ini<<OPO
extension=rdkafka.so
OPO

else
  echo "rdkafka module exsit"
fi

}

redis
memcache
memcached
imagick
zookeeper
librdkafka
mcrypt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335

# 查看 php 扩展

php -m

# 个人存储下载地址。。。

点击,获取下面下载资源

centos7 php 安装包地址

bison-3.0.4.tar.gz
libmcrypt-2.5.7.tar.gz
php-7.2.6.tar.gz
re2c-0.15.3.tar.gz

#7.2.6
php_7.2.6.sh 

#7.4.20
php-7.4.20.tar.gz
php_7.4.20.sh

php-7.2.6-mini.x86_64.rpm
php-7.4.20-1.x86_64.rpm

#扩展包安装
PHP_module.tar.gz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

扩展包地址

redis
memcache
memcached
imagick
zookeeper
librdkafka
mcrypt

## 可以下载该包,执行shell 脚本
wget PHP_module.tar.gz
tar xf PHP_module.tar.gz && cd PHP_module
bash 1-php-module.sh
1
2
3
4
5
6
7
8
9
10
11
12
//
如果此文章对您有帮助,点击 -->> 请博主喝咖啡 (opens new window)
上次更新: 2023/11/20, 16:23:11
fpm定制rpm
iptables规则

← fpm定制rpm iptables规则→

最近更新
01
Linux Polkit 权限提升漏洞(CVE-2021-4034)
03-28
02
postgreSQL维护
03-17
03
trivy系统漏洞扫描
02-25
更多文章>
Theme by Vdoing | Copyright © 2019-2025 yangfk | 湘ICP备2021014415号-1
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
×
//