sudo apt install php php-cli php-fpm php-json php-pdo php-mysql \
php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
Syntax alternatif
sudo apt install php php-{cli,fpm,json,pdo,mysql,zip,gd,mbstring,curl,xml,pear,bcmath}
Dengan Apache, general
sudo apt install libapache2-mod-php php php-cli php-fpm php-json php-pdo php-mysql \
php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
Syntax alternatif
sudo apt install libapache2-mod-php php php-{cli,fpm,json,pdo,mysql,zip,gd,mbstring,curl,xml,pear,bcmath}
sudo apt install memcached php-memcached php-apcu
To install pecl package from pecl, for example apcu, redis, imagick. Yu must install php-pear and php developer package
sudo apt install php-pear php-dev build-essential -y
sudo pecl install apcu
Check if apcu.ini is already exists in /etc/php/7.4/mods-available/apcu.ini, if not add
echo "extension = apcu.so" | sudo tee -a /etc/php/7.4/mods-available/apcu.ini
Add symlink to php-fpm and php cli
sudo ln -s /etc/php/7.4/mods-available/apcu.ini /etc/php/7.4/fpm/conf.d/30-apcu.ini
sudo ln -s /etc/php/7.4/mods-available/apcu.ini /etc/php/7.4/cli/conf.d/30-apcu.ini
sudo pecl install redis
Check if apcu.ini is already exists in /etc/php/7.4/mods-available/redis.ini, if not add
echo "extension = redis.so" | sudo tee -a /etc/php/7.4/mods-available/redis.ini
Add symlink to php-fpm and php cli
sudo ln -s /etc/php/7.4/mods-available/redis.ini /etc/php/7.4/fpm/conf.d/30-redis.ini
sudo ln -s /etc/php/7.4/mods-available/redis.ini /etc/php/7.4/cli/conf.d/30-redis.ini
sudo service php7.4-fpm restart
sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt -y install php7.4 php7.4-{fpm,bcmath,bz2,intl,gd,mbstring,mysql,zip,xml}
sudo systemctl disable --now apache2