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 进行编译安装

未完待续

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

接上回:

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

很简单_

点个赞在走呗 ~~~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值