What this is
This guide shows how to install PHP and confirm it is working.
What it is for
- Run PHP websites (WordPress, Laravel, etc.)
- Use PHP CLI for scripts
Prerequisites
- SSH + sudo
Step-by-step by distribution
Ubuntu/Debian
sudo apt update
sudo apt install -y php php-cli php-fpm php-mysql
RHEL/Rocky/Alma
sudo dnf install -y php php-cli php-fpm php-mysqlnd
Verify version
php -v
Verify PHP-FPM (if installed)
sudo systemctl status php-fpm --no-pager
Conclusion
PHP is installed and you can confirm its version. Next steps: configure Nginx/Apache to use PHP-FPM.