Linux-php5.7安装过程

本文详细介绍了在Linux系统中如何安装PHP5.7,包括检查现有PHP状态、安装epel-release、配置rpm源、安装PHP、配置php-fpm,以及解决编译过程中可能遇到的问题和解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、检查是否安装php

yum search php
yum info php        // 查看php版本信息

下载
wget https://www.php.net/distributions/php-7.1.31.tar.gz

2、安装epel-release

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

3、安装php7的rpm源

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

4、安装php7

// 安装依赖
yum install libxml2 libxml2-devel openssl openssl-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel

mv php7.1.31 /usr/local

cd /usr/local/php7.1.31

// 开始进行配置-配置参数详解
./configure --prefix=/usr/local/php7 --with-config-file-path=/etc/ --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-simplexml --enable-xml --disable-rpath --enable-bcmath --enable-soap --enable-zip --with-curl --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache --disable-fileinfo

--with-config-file-path 用于存放php.ini的目录

// 编译安装
make
make install

// 添加php命令到环境变量里
vim /etc/profile
// 在文件末尾加入:
PATH=$PATH:/usr/local/php7/bin
export PATH
// 使改动立即生效执行
source /etc/profile
// 查看php版本
php -v
PHP 7.1.31 (cli) (built: Sep 16 2020 17:27:27) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

5、配置

cp /usr/local/php-7.1.31/php.ini-pro
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值