Contents

编译安装php-fpm

Contents

使用编译安装php的方法 首先安装php相关依赖

1
2
yum -y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel libicu-devel freetype-devel openldap-devel openldap openldap-devel
yum -y install gcc gcc-c++ make  sqlite-devel.x86_64  oniguruma-devel.x86_64  libxslt-devel.x86_64  libzip-devel.x86_64 

下载php本体(官方链接) #以7.4.28版本为例 wget https://www.php.net/distributions/php-7.4.28.tar.gz 进入文件夹 cd php-7.4.28 运行脚本

 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
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-fpm-user=www \
--with-fpm-group=www \
--with-curl \
--with-MySQL=/usr/local/mysql \
--with-freetype-dir=/usr/local/freetype \
--enable-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir=/usr/local/libpng \
--with-jpeg-dir=/usr/local/libjpeg \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--with-zlib-dir=/usr/local/zlib \
--with-bz2 \
--with-mhash \
--with-zip \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-xml \
--enable-zip \
--enable-fpm

编译并安装 make && make install 将配置文件做一个软连接到etc下 ln -s /usr/local/php/etc/php.ini /etc/php.ini