K8s--lamp architecture (3) php compilation and installation

1. Resource preparation

yum install bzip2 -y    %安装解压工具
tar jxf php-7.4.12.tar.bz2 
cd php-7.4.12/
yum search systemd
yum install -y systemd-devel.x86_64
yum search libxml2
yum install -y libxml2-devel.x86_64
yum search sqlite
yum install -y sqlite-devel.x86_64
yum install -y oniguruma-devel-6.8.2-1.el7.x86_64.rpm oniguruma-6.8.2-1.el7.x86_64.rpm
yum install -y libevent-devel-1.4.13-4.el6.x86_64.rpm libevent-doc-1.4.13-4.el6.noarch.rpm libevent-headers-1.4.13-4.el6.noarch.rpm
yum install -y libpng-devel.x86_64

上面这些rpm包都是在编译的时候根据报错提示安装的

Insert picture description here
Insert picture description here

Two, compile and install

1. Add nginx users and change nginx configuration

In order to ensure the normal communication between nginx and php, you need to configure nginx before compiling php

useradd -M -d /usr/local/nginx/ -s /sbin/nologin nginx
cd /usr/local/nginx/
cd conf/
ls
vim nginx.conf      %编辑配置文件
文件开头加上 user nginx nginx
nginx -s reload
ps -aux             %查看进程用户信息

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

2. Execute the configure file

 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-mysqlnd --with-pdo-mysql --with-mysqli --with-openssl-dir --enable-gd --with-zlib-dir --with-curl --with-pear --enable-inline-optimization --enable-soap --enable-sockets --enable-mbstring --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-fpm-systemd

Insert picture description here
Insert picture description here
Insert picture description here

3.make && make install

执行configure文件后执行(这个过程需要一些时间):
make
make install   

Insert picture description here
For a detailed explanation of the three steps of source code compilation, please refer to the following link:
Link: https://blog.csdn.net/crazyeden/article/details/78926817 .

For detailed explanation of cmake and configure, please refer to the following link:
link: http://www.ttlsa.com/mysql/configure-to-cmake/ .

Guess you like

Origin blog.csdn.net/nk298120/article/details/115343240