How to manually install PHP on Linux?

To manually install PHP in Linux, you can follow these steps:

  1. Open the terminal and log in as the root user.
  2. Update package manager.
sudo apt update
  1. Install the dependencies required for PHP.
sudo apt install software-properties-common
  1. Add Ondřej Surý’s PHP PPA repository.
sudo add-apt-repository ppa:ondrej/php
  1. Package manager update:
sudo apt update
  1. Install PHP and its related components.
sudo apt install php7.4
sudo apt install php7.4-cli php7.4-common php7.4-curl php7.4-mbstring php7.4-mysql php7.4-xml php7.4-zip

Depending on your needs, you can choose to install other PHP components.

  1. Check if the PHP installation was successful.
php -v

This will allow you to manually install PHP. Please note that specific commands may vary depending on the Linux distribution.

bannerAds