php 源码方式安装php7.4
作者:互联网
环境
Ubuntu 20.04
安装前准备
安装PHP软件依赖
sudo apt-get update
sudo apt-get install libxml2-dev
sudo apt-get install build-essential
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install curl
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libpng-dev
sudo apt-get install libmcrypt-dev
sudo apt-get install libreadline6 libreadline6-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install libzip-dev
下载PHP源码
wget https://www.php.net/distributions/php-7.4.8.tar.gz
解压源码
tar -zxvf php-7.4.8.tar.gz
安装PHP
编译生成Makefile文件
./configure --prefix=/usr/local/php --enable-fpm --with-zip --with-mysqli --enable-gd \
--with-zlib --with-curl --enable-mbstring --enable-bcmath --disable-ctype --with-openssl \
--enable-tokenizer --enable-sockets
编译源码
make
安装php
sudo make install
配置环境变量
cd ~
sudo vi .profile
添加内容
PATH=$PATH:$HOME/bin
export PHTH
alias php=/usr/local/php/bin/php
环境变量生效
source ~/.profile
测试PHP
php -v
标签:sudo,get,--,php7.4,apt,源码,install,php 来源: https://www.cnblogs.com/hu308830232/p/15164740.html