編譯安裝php7 4 12(fscgi模式)

2022-05-08 17:03:16 字數 1909 閱讀 2567

#安裝相關包

[root@tencent-centos7 ~]#yum -y install gcc libxml2-devel bzip2-devel libmcrypt-devel sqlite-devel oniguruma-devel

#編譯[root@tencent-centos7 ~]#tar xvf php-7.4.12.tar.bz2

[root@tencent-centos7 ~]#cd php-7.4.12

[root@tencent-centos7 php-7.4.12]#./configure \

--enable-mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-openssl \

--with-zlib \

--with-config-file-path=/etc \

--with-config-file-scan-dir=/etc/php.d \

--enable-mbstring \

--enable-xml \

--enable-sockets \

--enable-fpm \

--enable-maintainer-zts \

--disable-fileinfo

[root@tencent-centos7 php-7.4.12]#make -j 8 && make install

#準備path變數

[root@tencent-centos7 php-7.4.12]#. /etc/profile.d/php.sh

# 檢視版本資訊,確認安裝成功

[root@tencent-centos7 php-7.4.12]#php --version

php 7.4.12 (cli) (built: nov 11 2020 21:36:08) ( zts )

#準備php配置檔案和啟動檔案

[root@tencent-centos7 php-7.4.12]#cp php.ini-production /etc/php.ini

[root@tencent-centos7 php-7.4.12]#cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/

[root@tencent-centos7 etc]#cp php-fpm.conf.default php-fpm.conf

[root@tencent-centos7 etc]#cd php-fpm.d/

[root@tencent-centos7 php-fpm.d]#cp www.conf.default www.conf

# 修改php-fpm配置檔案

#修改程序所有者

user apache

group apache

#支援status和ping頁面

pm.status_path = /status

ping.path = /ping  

#開啟opcache加速

[root@tencent-centos7 php-fpm.d]#mkdir /etc/php.d/

[root@tencent-centos7 php-fpm.d]#vim /etc/php.d/opcache.ini

[opcache]

zend_extension=opcache.so              

opcache.enable=1

[root@tencent-centos7 php-fpm.d]#systemctl daemon-reload

[root@tencent-centos7 php-fpm.d]#systemctl enable --now php-fpm.service

centos 8編譯安裝php7 4 12

yum install sqlite devel oniguruma autoconf automake libtool libzip libzip devel unzip oniguruma master.zip autogen.sh configure prefix usr make make ...

PHP 編譯安裝PHP

1.安裝php所有的依賴軟體包 root web01 yum install zlib devel libxml2 devel libjpeg devel freetype devel libpng devel gd devel libcurl devel libxslt devel openssl...

PHP編譯安裝

錯誤1configure error xml2 config not found.please check your libxml2 installation.解決方案 yum install y libxml2 devel錯誤2 configure error cannot find openss...