wget https://www.php.net/distributions/php-7.4.0.tar.gz
tar xvf php-7.4.0.tar.gz
cd php-7.4.0
安装依赖
sudo apt-get install build-essential
sudo apt-get install -y pkg-config
sudo apt-get install libxml2-dev
sudo apt-get install libssl-dev
sudo apt-get install sqlite3 libsqlite3-dev
sudo apt-get install libbz2-dev
sudo apt-get install libgmp3-dev
sudo apt-get install libonig-dev
sudo apt-get install -y libedit-dev libreadline-dev
sudo apt-get install libxslt1-dev
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql-sock --with-mysqli --with-libxml-dir --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-zlib --with-iconv --with-bz2 --with-curl --with-cdb --with-pcre-dir --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --with-gettext --with-gmp --with-mhash --with-libmbfl --with-onig --with-pdo-mysql --with-zlib-dir --with-readline --with-libxml-dir --with-xsl --with-pear --enable-fpm --enable-soap --enable-bcmath --enable-calendar --enable-dom --enable-exif --enable-fileinfo --enable-filter --enable-ftp --enable-gd-native-ttf --enable-gd-jis-conv --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --enable-pdo --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-zip --enable-mysqlnd-compression-support
sudo make
sudo make install
nginx.conf
location ~ .php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}