Why id CGI/FCGI disabled in lighttpd?

Expected Behaviour:

lighttpd should execute CGI / FCGI

Actual Behaviour:

lighttpd does not execute CGI / FCGI

I want to run an additional site on pi hole's lighttpd. It is generated by FCGI. However, execution of CGI / FCGI seems to be disabled by pi hole's lighttpd configuration. Does anyone know the reasons behind this? Any disadvantage if I change the corresponding lighttpd config?

lighttpd should be configured to run PHP via CGI. Beyond that, we don't explicitly intend to disable CGI generally. If you change the config (instead of adding a config at /etc/lighttpd/external.conf or elsewhere), note that it will be overwritten when repairing or updating.

pi@noads:~ $ apt show php7.0-cgi
[..]
Description: server-side, HTML-embedded scripting language (CGI binary)
 This package provides the /usr/lib/cgi-bin/php CGI interpreter built
 for use in Apache 2 with mod_actions, or any other CGI httpd that
 supports a similar mechanism.  Note that MOST users probably
 want the php7.0-fpm package.
 .
 The following extensions are built in: Core date filter hash libxml openssl
 pcntl pcre Reflection session SPL standard zlib.
 .
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.

pi@noads:~ $ apt-file list php7.0-cgi
php7.0-cgi: /etc/apache2/conf-available/php7.0-cgi.conf
php7.0-cgi: /usr/bin/php-cgi7.0
php7.0-cgi: /usr/lib/cgi-bin/php7.0
php7.0-cgi: /usr/lib/php/7.0/sapi/cgi
php7.0-cgi: /usr/share/bug/php7.0-cgi/control
php7.0-cgi: /usr/share/bug/php7.0-cgi/script
php7.0-cgi: /usr/share/doc/php7.0-cgi
php7.0-cgi: /usr/share/lintian/overrides/php7.0-cgi
php7.0-cgi: /usr/share/man/man1/php-cgi7.0.1.gz

pi@noads:~ $ apt depends php7.0-cgi
php7.0-cgi
  Depends: libmagic1
  Depends: libpcre3 (>= 1:8.20)
  Depends: mime-support
  Depends: php7.0-cli
  Depends: php7.0-common (= 7.0.33-0+deb9u3)
  Depends: php7.0-json
  Depends: php7.0-opcache
  Depends: tzdata
  Depends: ucf
  Depends: libc6 (>= 2.15)
  Depends: libssl1.1 (>= 1.1.0)
  Depends: libxml2 (>= 2.8.0)
  Depends: zlib1g (>= 1:1.2.3.4)
  Suggests: php-pear

pi@noads:~ $ apt show php7.0-fpm
[..]
Description: server-side, HTML-embedded scripting language (FPM-CGI binary)
 This package provides the Fast Process Manager interpreter that runs
 as a daemon and receives Fast/CGI requests.  Note that MOST Apache users
 probably want the libapache2-mod-php7.0 package.
 .
 The following extensions are built in: Core date filter hash libxml openssl
 pcre Reflection session SPL standard zlib.
 .
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.

pi@noads:~ $ apt-file list php7.0-fpm
php7.0-fpm: /etc/apache2/conf-available/php7.0-fpm.conf
php7.0-fpm: /etc/init.d/php7.0-fpm
php7.0-fpm: /etc/init/php7.0-fpm.conf
php7.0-fpm: /etc/logrotate.d/php7.0-fpm
php7.0-fpm: /etc/php/7.0/fpm/php-fpm.conf
php7.0-fpm: /etc/php/7.0/fpm/pool.d/www.conf
php7.0-fpm: /lib/systemd/system/php7.0-fpm.service
php7.0-fpm: /usr/lib/php/7.0/sapi/fpm
php7.0-fpm: /usr/lib/php/php7.0-fpm-reopenlogs
php7.0-fpm: /usr/lib/tmpfiles.d/php7.0-fpm.conf
php7.0-fpm: /usr/sbin/php-fpm7.0
php7.0-fpm: /usr/share/bug/php7.0-fpm/control
php7.0-fpm: /usr/share/bug/php7.0-fpm/script
php7.0-fpm: /usr/share/doc/php7.0-fpm
php7.0-fpm: /usr/share/lintian/overrides/php7.0-fpm
php7.0-fpm: /usr/share/man/man8/php-fpm7.0.8.gz
php7.0-fpm: /usr/share/php/7.0/fpm/status.html

pi@noads:~ $ apt depends php7.0-fpm
php7.0-fpm
  Depends: libmagic1
  Depends: libpcre3 (>= 1:8.20)
  Depends: mime-support
  Depends: php7.0-cli
  Depends: php7.0-common (= 7.0.33-0+deb9u3)
  Depends: php7.0-json
  Depends: php7.0-opcache
  Depends: procps
  Depends: tzdata
  Depends: ucf
  Depends: init-system-helpers (>= 1.18~)
  Depends: libapparmor1 (>= 2.7.0~beta1+bzr1772)
  Depends: libc6 (>= 2.15)
  Depends: libssl1.1 (>= 1.1.0)
  Depends: libsystemd0
  Depends: libxml2 (>= 2.8.0)
  Depends: zlib1g (>= 1:1.2.3.4)
  Suggests: php-pear

https://www.cyberciti.biz/tips/lighttpd-php-fastcgi-configuration.html

Install the package (depending PHP version):

sudo apt install php7.0-fpm

And put additional configuration directives in below file:

/etc/lighttpd/external.conf

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.