安裝centos源
yum install epel-release –y
下載php安裝壓縮包

wget https://www.php.net/distributions/php-7.3.15.tar.gz

解壓 tar xf php-7.3.15.tar.gz
進入php-7.3.15檔案目錄
安裝php依賴
yum install gcc \
gcc-c++ \
libxml2 \
libxml2-devel \
openssl \
openssl-devel \
libcurl \
libcurl-devel \
freetype \
freetype-devel \
libjpeg \
libjpeg-devel \
libpng \
libpng-devel \
libxslt \
libxslt-devel \
systemd-devel \
libicu-devel \
libedit-devel
安裝cmake3
yum install cmake3 –y
拷貝一份,重命名為cmake
cp /usr/bin/cmake3 /usr/bin/cmake
查看cmake是否為3.0以上版本
cmake –version
第二步:安裝libzip1.5.2
安裝bzip2-devel依賴包
yum install bzip2 bzip2-devel -y
到官網下載libzip壓縮包

wget https://libzip.org/download/libzip-1.6.1.tar.gz
解壓進入libzip-1.6.1創建build目錄
tar xf libzip-1.6.1.tar.gz
cd libzip-1.6.1
mkdir build
進入build目錄里面執行cmake …,make,make安裝
cd build
cmake …
make
make install
創建www用戶
useradd -M -s /sbin/nologin www
-M:不要自動建立用戶的登入目錄
-s 用戶不能用作登錄
Id www 查看
#修改庫加載路徑
vim /etc/ld.so.conf
#添加如下幾行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
使之生效:
ldconfig -v
進入php-7.3.15目錄配置
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-config-file-scan-dir=/usr/local/php/etc/conf.d \
--disable-cgi \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-ftp \
--with-curl \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libedit \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-xsl \
--with-zlib \
--with-mhash \
--with-mysqli \
--with-png-dir=/usr/lib \
--with-jpeg-dir=/usr/lib\
--with-freetype-dir=/usr/lib \
--enable-mysqlnd \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-jis-conv \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip \
--enable-calendar \
--enable-intl \
--enable-exif
然后編譯安裝大概10分鐘
make
make install
拷貝開發配置到安裝目錄
cp php.ini-development /usr/local/php/etc/php.ini
進入安裝目錄
cd /usr/local/php/etc/
復制一份組態檔
cp php-fpm.conf.default php-fpm.conf
拷貝啟動腳本到指定目錄
cp /root/php-7.3.15/sapi/fpm/php-fpm.service /usr/lib/systemd/system/
修改組態檔名
cd /usr/local/php/etc/php-fpm.d
cp www.conf.default www.conf
啟動PHP
systemctl start php-fpm
允許自啟
systemctl enable php-fpm
查看狀態
systemctl status php-fpm

查看行程
ps -ef|grep php-fpm
查看埠
ss -lntup|grep 9000
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/27144.html
標籤:Linux
