php7.4於2019年底發佈,而截至2020/04月國內提供apt下載7.4的源還沒有。只能求於國外的源,但速度慢實在無法容忍。這裏介紹下全套的安裝方法
1. 安裝apt常用工具包
sudo apt-get -y install
Ps:Ubuntu 16.04 LTS 後使用 apt 取代 apt-get
2. 使用apt-fast 提升下載速度的軟件,安裝軟件時,通過增加線程使下載軟件速度加快。
sudo add-apt-repository ppa:apt-fast/stable
sudo apt-get install apt-fast
先添加apt-fast的安裝源 然後安裝。在出現的GUI畫面依此選擇替換apt-get, 設置最大16線程,和yes。到這一步就安裝好了apt-fast
卸載系統中已有的php版本和擴展
sudo apt-get autoremove php*
添加php7.4的源
sudo add-apt-repository ppa:ondrej/php && sudo apt-get update
使用apt-fast 安裝php7.4
sudo apt-fast -y install php7.4
安裝php7.4必要的擴展
sudo -y apt-fast install php7.4-dev //phpize需要
sudo -y apt-fast install php-pear //pecl需要
sudo -y apt-fast install php7.4-fpm php7.4-mysql php7.4-curl php7.4-json php7.4-mbstring php7.4-xml php7.4-intl
安裝可選擴展
sudo apt-fast install php7.4-gd
sudo apt-fast install php7.4-soap
sudo apt-fast install php7.4-gmp
sudo apt-fast install php7.4-odbc
sudo apt-fast install php7.4-pspell
sudo apt-fast install php7.4-bcmath
sudo apt-fast install php7.4-enchant
sudo apt-fast install php7.4-ldap
sudo apt-fast install php7.4-opcache
sudo apt-fast install php7.4-readline
sudo apt-fast install php7.4-sqlite3
sudo apt-fast install php7.4-xmlrpc
sudo apt-fast install php7.4-bz2
sudo apt-fast install php7.4-interbase
sudo apt-fast install php7.4-pgsql
sudo apt-fast install php7.4-recode
sudo apt-fast install php7.4-sybase
sudo apt-fast install php7.4-xsl
sudo apt-fast install php7.4-cgi
sudo apt-fast install php7.4-dba
sudo apt-fast install php7.4-phpdbg
sudo apt-fast install php7.4-snmp
sudo apt-fast install php7.4-tidy
sudo apt-fast install php7.4-zip*
到這裏就安裝完成! 想體驗極速的php7.4預加載的夥伴,可以一試了。
本文由 www.7php.cn 原創