centos7 源码编译安装php7.4
时间: 2023-10-16 13:10:31 浏览: 151
源码编译安装php7.4在CentOS 7上相对来说比较复杂,但我们可以通过以下步骤来完成:
1. 首先,确保你的系统已经安装了必要的编译工具和依赖库:
```
yum install epel-release
yum install gcc gcc-c++ autoconf automake
yum install libxml2-devel libjpeg-devel libpng-devel libwebp-devel libxpm-devel freetype-devel libmcrypt-devel libzip-devel openssl-devel curl-devel libxslt-devel libicu-devel libmemcached-devel libevent-devel libuuid-devel
```
2. 下载php7.4的源码包并解压:
```
cd /usr/local/src
wget --timeout=7200 https://www.php.net/distributions/php-7.4.30.tar.gz
tar -zxvf php-7.4.30.tar.gz
cd php-7.4.30
```
3. 配置编译选项:
```
./configure --prefix=/usr/local/php74 --with-config-file-path=/usr/local/php74/etc --enable-mbstring --with-curl --with-openssl --with-zlib --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-libxml --enable-opcache --enable-zip --with-gd --with-jpeg --with-webp --with-xpm --with-freetype --enable-intl --with-xsl --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-sockets
```
4. 编译并安装:
```
make
make install
```
5. 复制配置文件:
```
cp php.ini-production /usr/local/php74/etc/php.ini
```
至此,你已经成功源码编译安装了php7.4。你可以根据需要调整配置文件`/usr/local/php74/etc/php.ini`来满足你的需求。
其他
阅读全文