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 ```
- Enable and start PHP-FPM:
bash
sudo systemctl enable --now php8.2-fpm # adjust version
sudo systemctl status php8.2-fpm
- Check the installed version and loaded modules:
bash
php -v
php -m
- Point your web server at PHP-FPM:
- Nginx: add a
location ~ \.php$block withfastcgi_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
- Create a test file and load it in the browser:
bash
echo "<?php phpinfo();" | sudo tee /var/www/example.com/html/info.php
Remove the test file afterwards —
phpinfo()exposes configuration details.Tune
php.inifor 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_passsocket path orrootis wrong; confirm withls /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 --iniand the FPM pool config), not just the CLI one.
Related articles
- [Installing the Apache web server]
- [Installing the Nginx web server]
- [Installing WordPress]
