http://www.php.cn/php/php-tp-inst安裝PHP7.0
sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install -y php7.0 sudo apt-get install php7.0 php7.0-dev php7.0-mysql php7.0-curl php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-intl php7.0-json php7.0-memcached php7.0-mysqlnd php7.0-readline php7.0-zip
已經安裝過得PHP升級到php7.0
sudo add-apt-repository ppa:ondrej/php 註: 如果提示:sudo: add-apt-repository: command not found 執行: sudo apt-get install software-properties-common
更新所有程式
sudo apt-get update
刪除之前PHP5 的擴充
sudo apt-get purge php5-*
安裝所有更新後的資料
sudo apt-get upgrade
安裝PHP7 以及之前刪除的擴充
sudo apt-get install php7.0 php7.0-dev php7.0-mysql php7.0-curl php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-intl php7.0-json php7.0-memcached php7.0-mysqlnd php7.0-readline php7.0-zip
配置/etc/php7/cli/php.ini中設定時區
date.timezone = Asia/Shanghai
安裝apcu,apcu_bc 擴充
sudo apt-get install php-apcu php-apcu-bc
當上述命令無法安裝時,需要手動下載安裝包,自行安裝:
// 下載安裝包 wget http://mirrors.kernel.org/ubuntu/pool/universe/p/php-apcu/php-apcu_5.1.7+4.0.11-2_amd64.deb wget http://mirrors.kernel.org/ubuntu/pool/universe/p/php-apcu-bc/php-apcu-bc_1.0.3-2_amd64.deb // 安裝軟體 sudo dpkg -i php-apcu_5.1.7+4.0.11-2_amd64.deb sudo dpkg -i php-apcu-bc_1.0.3-2_amd64.deb
php.ini 配置 apcu
開啟 /etc/php/7.0/mods-available/apcu.ini 添加代碼: apc.enable_cli=On