This post is a quick post to serve as a note, don’t expect long explanations of general LAMP stack design concepts. If you encounter any issues feel free to leave a comment below.
Step 1: Bash Into root User
sudo bash
#("sudo -su" if you prefer)
Enter your password to enter the root superuser account.
Step 2: Preparation
As root enter
apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get autoclean -y
Step 3: Adding PHP8 Repository
apt-get install ca-certificates apt-transport-https software-properties-common -y
Once the command above completes its process:
add-apt-repository ppa:ondrej/php -y && apt-get update -y
Step 4: Installing PHP8
apt-get install php8.0 libapache2-mod-php8.0 -y && systemctl restart apache2
apt-get install php8.0-fpm libapache2-mod-fcgid
Enable default PHP8 FastCGI manager module and config:
a2enmod proxy_fcgi setenvif
a2enconf php8.0-fpm
Restart Apache:
systemctl restart apache2
You might need these as well… MySQL, MBString, and MailParse
apt-get install php8.0-mbstring php8.0-mailparse php8.0-mysql php8.0-xml php8.0-zip -y
WordPress Modules
apt-get install php8.0-imagick -y
*****
To get jiggy with it… (installs all PHP modules, typically reserved for DevOps/Sandboxing)
apt-get install php8.0-dev
*****
Once you’re done with installing any additional modules, although not required, it’s recommended you reboot your machine. Let’s do a little cleanup in case something unnecessary (like previous PHP7 packages) was left behind.
apt-get update -y && apt-get upgrade -y && dist-upgrade -y && apt-get autoclean -y && apt-get autoremove -y && reboot
Step 5 (Optional): Additional Caching Modules
Memcached
apt-get install php8.0-memcached
Redis
apt-get install php8.0-redis