Terug na blog
Mei 23, 2026Gidse

Hoe om PHP op VPS te installeer (Ubuntu en CentOS)

PHP 8.x met uitbreidings vir WordPress, Laravel en ander CMS.

Hoe om PHP op VPS te installeer (Ubuntu en CentOS)

Die meeste werwe benodig PHP. Installeer PHP 8.x en uitbreidings op Hiddence Ubuntu- en CentOS-bedieners.

Ubuntu / Debian

bash
sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install -y php8.2 php8.2-fpm php8.2-cli php8.2-mysql php8.2-curl php8.2-gd php8.2-mbstring php8.2-xml php8.2-zip php8.2-redis
sudo systemctl enable php8.2-fpm
sudo systemctl start php8.2-fpm
php -v

CentOS / RHEL / Alma / Rocky

bash
sudo yum install -y epel-release
sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
sudo yum module reset php -y
sudo yum module enable php:remi-8.2 -y
sudo yum install -y php php-fpm php-mysqlnd php-gd php-mbstring php-xml php-zip php-redis
sudo systemctl enable php-fpm
sudo systemctl start php-fpm
php -v

Ekstra uitbreidings

Installeer volgens programvereistes:

bash
# Ubuntu example:
sudo apt install -y php8.2-intl php8.2-bcmath php8.2-imagick

# Then restart PHP-FPM:
sudo systemctl restart php8.2-fpm

PHP-FPM met Nginx

bash
sudo nano /etc/nginx/sites-available/default

# Inside server block:
location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}

sudo nginx -t && sudo systemctl reload nginx

Wenke

  • PHP-weergawe moet ooreenstem met CMS of raamwerk
  • Stel memory_limit en upload_max_filesize in php.ini
  • Pas PHP-FPM-poele aan vir hoë verkeer
  • Moenie phpinfo() in produksie laat nie
  • Hou PHP op datum vir sekuriteitspatches