Tools: Latest: Installing PHP and PHP-FPM on Ubuntu 26.04

Tools: Latest: Installing PHP and PHP-FPM on Ubuntu 26.04

Install PHP

Install PHP Extensions

Install PHP-FPM

Integrate with Nginx

Verify the Installation

Next Steps Ubuntu 26.04 ships PHP 8.5 in its default APT repository, and PHP-FPM handles PHP execution through a FastCGI process pool that scales independently of the web server. This guide installs PHP 8.5 with common extensions, configures PHP-FPM, and integrates it with Nginx so PHP requests are processed efficiently. By the end, you'll have PHP and PHP-FPM running with Nginx serving a verified PHP page. PHP 8.5 is available in Ubuntu 26.04's default APT repository. 1. Update the APT package index: 3. Verify the installed version: Extensions add capabilities like database connectivity, image processing, and archive handling. 1. Install common PHP extensions: What you just installed: 2. Verify extensions are loaded: PHP-FPM manages a pool of FastCGI worker processes that handle incoming PHP requests from the web server. 2. Enable and start the service: 3. Check the service status: 4. Verify the socket exists: 2. Create the web root directory: 3. Create the virtual host configuration: 4. Enable the site and reload Nginx: 1. Create a PHP info page: 2. Open the page in a browser: Visit http://app.example.com/info.php. The PHP info page confirms PHP 8.5 is running through PHP-FPM. 3. Remove the info page: PHP and PHP-FPM are now installed and integrated with Nginx. From here you can: For the full guide with additional tips, visit the original article on Vultr Docs. Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Command

Copy

$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php -y $ php --version $ php --version $ php --version $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php-mysql php-mbstring php-bcmath php-zip php-gd php--weight: 500;">curl php-xml -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php-mysql php-mbstring php-bcmath php-zip php-gd php--weight: 500;">curl php-xml -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php-mysql php-mbstring php-bcmath php-zip php-gd php--weight: 500;">curl php-xml -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php-fpm -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php-fpm -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install php-fpm -y $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable php8.5-fpm $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start php8.5-fpm $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable php8.5-fpm $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start php8.5-fpm $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable php8.5-fpm $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start php8.5-fpm $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status php8.5-fpm $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status php8.5-fpm $ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status php8.5-fpm $ ls /run/php/php8.5-fpm.sock $ ls /run/php/php8.5-fpm.sock $ ls /run/php/php8.5-fpm.sock $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y $ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install nginx -y $ -weight: 600;">sudo mkdir -p /var/www/app.example.com $ -weight: 600;">sudo chown -R www-data:www-data /var/www/app.example.com $ -weight: 600;">sudo mkdir -p /var/www/app.example.com $ -weight: 600;">sudo chown -R www-data:www-data /var/www/app.example.com $ -weight: 600;">sudo mkdir -p /var/www/app.example.com $ -weight: 600;">sudo chown -R www-data:www-data /var/www/app.example.com $ -weight: 600;">sudo nano /etc/nginx/sites-available/app.example.com.conf $ -weight: 600;">sudo nano /etc/nginx/sites-available/app.example.com.conf $ -weight: 600;">sudo nano /etc/nginx/sites-available/app.example.com.conf server { listen 80; server_name app.example.com; root /var/www/app.example.com; index index.php index.html; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.5-fpm.sock; } } server { listen 80; server_name app.example.com; root /var/www/app.example.com; index index.php index.html; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.5-fpm.sock; } } server { listen 80; server_name app.example.com; root /var/www/app.example.com; index index.php index.html; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.5-fpm.sock; } } $ -weight: 600;">sudo ln -s /etc/nginx/sites-available/app.example.com.conf /etc/nginx/sites-enabled/ $ -weight: 600;">sudo nginx -t $ -weight: 600;">sudo -weight: 500;">systemctl reload nginx $ -weight: 600;">sudo ln -s /etc/nginx/sites-available/app.example.com.conf /etc/nginx/sites-enabled/ $ -weight: 600;">sudo nginx -t $ -weight: 600;">sudo -weight: 500;">systemctl reload nginx $ -weight: 600;">sudo ln -s /etc/nginx/sites-available/app.example.com.conf /etc/nginx/sites-enabled/ $ -weight: 600;">sudo nginx -t $ -weight: 600;">sudo -weight: 500;">systemctl reload nginx $ -weight: 600;">sudo nano /var/www/app.example.com/info.php $ -weight: 600;">sudo nano /var/www/app.example.com/info.php $ -weight: 600;">sudo nano /var/www/app.example.com/info.php <?php phpinfo(); ?> <?php phpinfo(); ?> <?php phpinfo(); ?> $ -weight: 600;">sudo rm /var/www/app.example.com/info.php $ -weight: 600;">sudo rm /var/www/app.example.com/info.php $ -weight: 600;">sudo rm /var/www/app.example.com/info.php - php-mysql: MySQL and MariaDB database connectivity - php-mbstring: multi-byte character encoding support - php-bcmath: arbitrary precision mathematics - php-zip: ZIP archive handling - php-gd: image creation and manipulation - php--weight: 500;">curl: HTTP client functionality - php-xml: XML parsing and formatting - Configure PHP-FPM pool settings in /etc/php/8.5/fpm/pool.d/www.conf to tune concurrency - Install Laravel or WordPress on the stack - Add Composer for PHP package management