install lighttp with php

All questions related to servers
Post Reply
mister_v
Posts: 199
Joined: Thu Mar 04, 2010 9:19 pm

install lighttp with php

Post by mister_v »

I have installed lighttp and php on a debian machine.
but php is not working yet.

I need to configure it to work together.
chris
Site Admin
Posts: 205
Joined: Mon Jul 21, 2008 9:52 am

Re: install lighttp with php

Post by chris »

You can install php-fpm,
best is to install the others also

Code: Select all

apt-get install php php-cli php-common php-fpm php-mysql
To enable PHP support for Lighttpd.
you need to modify the php.ini file

Code: Select all

nano /etc/php/7.4/fpm/php.ini
Change cgi.fix_pathinfo value to 1:

Code: Select all

cgi.fix_pathinfo=1
By default, PHP-FPM listens on the UNIX socket /var/run/php7-fpm.sock. So, we will need to modify the file /etc/php/7.4/fpm/pool.d/www.conf and set PHP-FPM to listens on TCP socket.
finde the line

Code: Select all

listen = /run/php/php7.4-fpm.sock
replace, or comment out, and add

Code: Select all

listen = 127.0.0.1:9000
Next step is to tell lighttpd to use the TCP-port.
in /etc/lighttpd/conf-available/15-fastcgi-php.conf

Code: Select all

"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/run/lighttpd/php.socket",
comment out or replace them with the following:

Code: Select all

"host" => "127.0.0.1",
"port" => "9000",
enable FastCGI + FastCGI-PHP modules with the following command:

Code: Select all

lighty-enable-mod fastcgi
lighty-enable-mod fastcgi-php
don't forget to restart:

Code: Select all

systemctl restart php7.4-fpm
systemctl restart lighttpd
should work now.
Post Reply