CentOS源码安装PHP+Nginx配置

一、下载PHP安装包

wget http://www.php.net/get/php-7.4.7.tar.bz2/from/jp1.php.net/mirror

如果下载不下来的话,就多下载几遍,实在不行就复制 url 到本地浏览器中下载,然后在上传到服务器上

下载完成后,进行解压:
tar -xvf php-7.4.7.tar.bz2
解压完后进入解压后的目录中 php-7.4.7
接下来生成 makefile 文件

./configure --prefix=/usr/local/php/php-7.4.7 --with-config-file-path=/usr/local/php/php-7.4.7/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64

参数可通过 ./configure -help 来查看是什么意思

如果 configure 失败,检查一下是不是相应的依赖包未安装,如果不确定是否安装,执行:

yum install gd-devel libjpeg-devel libpng-devel sqlite-devel libxml2-devel bzip2-devel libcurl-devel -y
# 安装 oniguruma 相关库
yum -y install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
yum -y install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-6.8.2-1.el7.x86_64.rpm

然后在 configure,出现如下信息就算好了,可以进行编译安装了

...
...
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE. By continuing this installation  |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

configure: WARNING: unrecognized options: --with-gd, --with-jpeg-dir, --with-png-dir, --with-freetype-dir, --enable-gd-native-ttf, --with-libxml-dir, --with-mysql

输入 make && make install 进行编译安装

未完待续

-----------------------------------------------------------------------------------------------------------------

接上回:

注:虚拟机崩了,没有后续了,不更了

你可能感兴趣的:(Linux运维,zabbix)