How to manually install PHP on Linux?
To manually install PHP in Linux, you can follow these steps:
- Open the terminal and log in as the root user.
- Update package manager.
sudo apt update
- Install the dependencies required for PHP.
sudo apt install software-properties-common
- Add Ondřej Surý’s PHP PPA repository.
sudo add-apt-repository ppa:ondrej/php
- Package manager update:
sudo apt update
- 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.
- 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.