This article details the sample code for installing PHP7, APCu, and APCu_bc in Ubuntu. if you need it, refer to # php/php-tp-inst to install 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 has been installed and upgraded to php7.0.
Sudo add-apt-repository ppa: ondrej/php note: If the prompt is: sudo: add-apt-repository: command not found, run: sudo apt-get install software-properties-common.
Update all programs
sudo apt-get update
Delete the PHP5 extension
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
Set the time zone in/etc/php7/cli/php. ini
date.timezone = Asia/Shanghai
Install apcu and apcu_bc extension
sudo apt-get install php-apcu php-apcu-bc
When the preceding command cannot be installed, you need to manually download the installation package and install it on your own:
// Download installation package 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 // install software 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
Configure apcu in php. ini
Open/etc/php/7.0/mod-available/apcu. ini and add the code: apc. enable_cli = On.
The above is a detailed description of the sample code for installing PHP7, APCu, and APCu_bc in Ubuntu. For more information, see other related articles in the first PHP community!