Home >Backend Development >PHP Tutorial >Detailed explanation of the sample code for installing PHP7, APCu, APCu_bc on Ubuntu
InstallationPHP7.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
Already installed PHP upgraded to php7.0
sudo add-apt-repository ppa:ondrej/php 注: 如果提示:sudo: add-apt-repository: command not found 执行: sudo apt-get install software-properties-common
UpdateAll programs
sudo apt-get update
DeletePrevious PHP5 extensions
sudo apt-get purge php5-*
Install all updated data
sudo apt-get upgrade
Install PHP7 and previously deleted extensions
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
Configure the time zone in /etc/php7/cli/php.ini
date.timezone = Asia/Shanghai
Install apcu, apcu_bc extensions
sudo apt-get install php-apcu php-apcu-bc
When the above command cannot be installed, you need to manually download the installation package and install it yourself:
// 下载安装包 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 configuration apcu
打开 /etc/php/7.0/mods-available/apcu.ini 添加代码: apc.enable_cli=On
The above is the detailed content of Detailed explanation of the sample code for installing PHP7, APCu, APCu_bc on Ubuntu. For more information, please follow other related articles on the PHP Chinese website!