1、下载源码包

wget https://www.php.net/distributions/php-7.4.20.tar.gz

2、安装必要工具软件依赖

sudo apt install -y build-essential gcc libcurl3-dev pkg-config libxml2-dev libssl-dev sqlite3 libsqlite3-dev libbz2-dev libgmp3-dev libonig-dev libedit-dev libreadline-dev libxslt1-dev autoconf postgresql

3、解压,配置

tar xvf php-7.4.20.tar.gz
cd php-7.4.20/
./configure --prefix=/usr/local/php74 --with-config-file-path=/usr/local/php74/ini_path --with-config-file-scan-dir=/usr/local/php74/config_path   --enable-mysqlnd   --with-pdo-mysql   --with-pdo-mysql=mysqlnd   --enable-bcmath   --enable-fpm   --with-fpm-user=www-data   --with-fpm-group=www-data   --enable-mbstring   --enable-phpdbg   --enable-shmop   --enable-sockets   --enable-sysvmsg   --enable-sysvsem   --enable-sysvshm   --with-zlib   --with-curl   --with-pear   --with-openssl   --enable-pcntl   --with-readline

make -j8 && make install

4、运行

/usr/local/php74/bin/php -v

PHP 7.4.20 (cli) (built: Jun 21 2021 16:10:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

本文链接地址:https://const.net.cn/110.html

标签: linux, php

添加新评论