Israel Hanukoglu, Ph.D.

Software : Installing Lighttpd with PHP 8.2 (PHP-FPM) and Sqlite3 on Linux Mint

This page is intended for people who wish to use Lighttpd server with PHP and Sqlite3 database.

The instructions below have been worded to match the latest version of Linux Mint 21.2, and version of PHP 8.2 that is included in the Software Manager of Linux. Some of the instructions have been adapted from a page at howtoforge. The installation employs PHP-FPM (FastCGI Process Manager).

STEP 1: Select and install programs that are already included in the Software Manager

STEP 2: Configuring Lighttpd and PHP 8.2

To enable PHP in Lighttpd, edit /etc/php/8.2/fpm/php.ini

sudo xed /etc/php/8.2/fpm/php.ini
and uncomment the line by deleting the ";" at the beginning of the line.
cgi.fix_pathinfo=1

For editing files I use xed. After saving the file, xed gives some warning messages for having edited as root. Can ignore these.

Before modifying 15-fastcgi-php.conf file, make a backup copy and then call xed to edit it:

cd /etc/lighttpd/conf-available/
sudo cp 15-fastcgi-php.conf 15-fastcgi-php.conf.bak
sudo xed 15-fastcgi-php.conf

Delete the content of the file and paste the following and then save the file.

## Start a FastCGI server for php
fastcgi.server += ( ".php" =>
((
	"socket" => "/var/run/php/php8.2-fpm.sock",
	"broken-scriptfilename" => "enable"
))
)

To enable the fastcgi configuration, run the following commands:

sudo lighttpd-enable-mod fastcgi
sudo lighttpd-enable-mod fastcgi-php

Before activating Lighttpd you may wish to modify the configuration file. For example, to specify the location of the localhost directory and default files. The definitions for these are in the configuration file:

sudo xed /etc/lighttpd/lighttpd.conf

Finally, after these changes, restart Lighttpd to activate the new configuration:

sudo /etc/init.d/lighttpd restart