Israel Hanukoglu, Ph.D.
Laboratory of Cell Biology
Ariel University
Ariel 40700, Israel

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

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 19 called Tara, and the latest version of PHP 7.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 7.2

To enable PHP in Lighttpd, edit /etc/php/7.2/fpm/php.ini and uncomment the line
cgi.fix_pathinfo=1
by deleting the ";" at the beginning of the line.

sudo xed /etc/php/7.2/fpm/php.ini

For editing files I use xed. After saving the file in Tara, xed yields 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.

# -*- depends: fastcgi -*-
# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

## Start a FastCGI server for php
fastcgi.server += ( ".php" =>
   ((
       "socket" => "/var/run/php/php7.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