Prerequisites
Before installing PHP, make sure you have:
- SSH access to your VPS
- Root or sudo privileges
Install PHP on Ubuntu/Debian
Connect to your VPS:
ssh hxroot@YOUR_SERVER_IP -p 22
apt update
apt install php php-cli php-fpm php-mysql php-curl php-xml php-zip php-gd -y
Verify PHP Installation
php --version
Create a test file:
echo "" > /var/www/html/info.php
Visit http://YOUR_SERVER_IP/info.php in browser.
Install Additional PHP Extensions
apt search php- | grep -E "php-.*"
✅ PHP has been installed on your VPS.