brucetexpeditefile
Posts: 24
Joined: Tue Jun 23, 2015 10:48 pm

lighttpd and PHP fail to start

Fri Feb 26, 2016 4:50 pm

I've tried to get the lighttpd web server installed on Jessie with PHP support without any luck. From the documentation on the web in several places, it says to simply do the following:

Code: Select all

sudo apt-get install lighttpd
sudo apt-get install php5-common php5-cgi php5
sudo lighty-enable-mod fastcgi-php
sudo service lighttpd force-reload
I can get the default page to show up but when I put in the php phpinfo(); call in a test file index.php, I get the following in the lighttpd log file (and no PHP output).

Code: Select all

2016-02-26 09:24:11: (log.c.164) server started 
2016-02-26 09:24:11: (mod_fastcgi.c.1112) the fastcgi-backend /usr/bin/php-cgi f
ailed to start: 
2016-02-26 09:24:11: (mod_fastcgi.c.1116) child exited with status 13 /usr/bin/p
hp-cgi 
2016-02-26 09:24:11: (mod_fastcgi.c.1119) If you're trying to run your app as a 
FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags. 
2016-02-26 09:24:11: (mod_fastcgi.c.1406) [ERROR]: spawning fcgi failed. 
2016-02-26 09:24:11: (server.c.1022) Configuration of plugins failed. Going down
. 
2016-02-26 09:30:23: (log.c.164) server started 

By the way, php-cgi --version works. (Can give the output if necessary)

Can somebody point me in the right direction?

Thanks in advance.

Bruce

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: lighttpd and PHP fail to start

Fri Feb 26, 2016 5:58 pm

Not sure you need php5. My lighttpd runs flawlessly without it.

Code: Select all

$ dpkg -l | grep php
ii  php5-cgi                       5.6.17+dfsg-0+deb8u1       armhf        server-side, HTML-embedded scripting language (CGI binary)
ii  php5-cli                       5.6.17+dfsg-0+deb8u1       armhf        command-line interpreter for the php5 scripting language
ii  php5-common                    5.6.17+dfsg-0+deb8u1       armhf        Common files for packages built from the php5 source
ii  php5-curl                      5.6.17+dfsg-0+deb8u1       armhf        CURL module for php5
ii  php5-json                      1.3.6-1                    armhf        JSON module for php5
ii  php5-readline                  5.6.17+dfsg-0+deb8u1       armhf        Readline module for php5
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

brucetexpeditefile
Posts: 24
Joined: Tue Jun 23, 2015 10:48 pm

Re: lighttpd and PHP fail to start

Sat Feb 27, 2016 4:14 pm

OK, I now have it running but all I did was change the input format. Here is the file that finally worked.

Code: Select all

<html>
<body>
<?php
phpinfo();
?>
</body>
</html>
However, if you put a space in the line that calls php such as this:

Code: Select all

<? php
or if you put the php text on the NEXT line like this:

Code: Select all

<?
php phpinfo(); 
the info table fails to display.

ripat, any chance you could try this experiment on your running system?

Thanks for your help!

Bruce

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: lighttpd and PHP fail to start

Sat Feb 27, 2016 6:05 pm

Normal behaviour. By default, the php short_open_tag <? is disabled.

If you want to use it (but why would you?) you will have to activate that option in a .user.ini file that you will create at the root of your site. Don't forget to restart lighttpd after that.

Code: Select all

$ cat .user.ini 
error_reporting = E_ALL
display_errors = On
html_errors = On
short_open_tag = On
You can also turn that option on in the /etc/php5/cgi/php.ini file.
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

brucetexpeditefile
Posts: 24
Joined: Tue Jun 23, 2015 10:48 pm

Re: lighttpd and PHP fail to start

Sun Feb 28, 2016 4:59 pm

Thank you very much!

....now if I can just figure out how to update all those 27 sites that describe how to get this to work that are going to break....

Bruce

Return to “Advanced users”