Teadmistebaas

Installing PHP and common extensions Prindi

  • php, php-fpm, extensions, lamp
  • 0

Overview

PHP powers most CMSes and web applications, including WordPress. To run them reliably you need PHP plus a set of common extensions (MySQL, GD, cURL, mbstring, XML, ZIP). This article shows how to install PHP on an ALYPOD CPU Pod, use PHP-FPM with a web server, and verify everything works.

Before you begin

  • A CPU Pod with root/sudo access.
  • Apache or Nginx installed (PHP-FPM integrates with both).
  • Knowledge of which PHP version your application requires.

Steps

Install PHP and extensions

```bash

Debian / Ubuntu

sudo apt update sudo apt install -y php php-fpm php-mysql php-curl php-gd php-mbstring \ php-xml php-zip php-intl php-bcmath php-imagick

RHEL / AlmaLinux / Rocky (enable the Remi repo for newer versions)

sudo dnf install -y epel-release sudo dnf install -y php php-fpm php-mysqlnd php-gd php-mbstring php-xml php-zip php-intl ```

  1. Enable and start PHP-FPM:

bash sudo systemctl enable --now php8.2-fpm # adjust version sudo systemctl status php8.2-fpm

  1. Check the installed version and loaded modules:

bash php -v php -m

  1. Point your web server at PHP-FPM:
  • Nginx: add a location ~ \.php$ block with fastcgi_pass unix:/run/php/php8.2-fpm.sock;.
  • Apache: enable the proxy modules and use SetHandler:

bash sudo a2enmod proxy_fcgi setenvif sudo a2enconf php8.2-fpm sudo systemctl reload apache2

  1. Create a test file and load it in the browser:

bash echo "<?php phpinfo();" | sudo tee /var/www/example.com/html/info.php

  1. Remove the test file afterwards — phpinfo() exposes configuration details.

  2. Tune php.ini for your app (memory limit, upload size, timezone):

ini memory_limit = 256M upload_max_filesize = 64M post_max_size = 64M date.timezone = UTC

Reload PHP-FPM after editing: sudo systemctl reload php8.2-fpm.

Troubleshooting

  • Problem: "File not found" from PHP-FPM. Solution: The fastcgi_pass socket path or root is wrong; confirm with ls /run/php/.
  • Problem: Extension missing for your app. Solution: Install the matching package (php-<name>) and restart FPM.
  • Problem: Changes to php.ini have no effect. Solution: Edit the file loaded by FPM (php --ini and the FPM pool config), not just the CLI one.

Related articles

  • [Installing the Apache web server]
  • [Installing the Nginx web server]
  • [Installing WordPress]

Kas see vastus oli kasulik?

« Tagasi