You are not logged in.

#1 2014-03-30 21:36:38

haroldjclements
Member
Registered: 2010-07-19
Posts: 30

[Solved] Problems with PHP on lighttpd

Hello form, I have followed the guide on the ArchWiki (https://wiki.archlinux.org/index.php/lighttpd). However, I am unable to get PHP working.

I have installed lighttpd (and works if I browsed to the machines IP).
I then installed fcgi,php and php-cgi.

# php-cgi --version
PHP 5.5.10 (cgi-fcgi) (built: Mar  5 2014 17:41:43)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

# php --version
PHP 5.5.10 (cli) (built: Mar  5 2014 17:41:10)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

I then created the following file: /etc/lighttpd/conf.d/fastcgi.conf

# Make sure to install php and php-cgi. See:                                                             
# https://wiki.archlinux.org/index.php/Fastcgi_and_lighttpd#PHP

server.modules += ("mod_fastcgi")

# FCGI server
# ===========
#
# Configure a FastCGI server which handles PHP requests.
#
index-file.names += ("index.php")
fastcgi.server = ( 
    # Load-balance requests for this path...
    ".php" => (
        # ... among the following FastCGI servers. The string naming each
        # server is just a label used in the logs to identify the server.
        "localhost" => ( 
            "bin-path" => "/usr/bin/php-cgi",
            "socket" => "/tmp/php-fastcgi.sock",
            # breaks SCRIPT_FILENAME in a way that PHP can extract PATH_INFO
            # from it 
            "broken-scriptfilename" => "enable",
            # Launch (max-procs + (max-procs * PHP_FCGI_CHILDREN)) procs, where
            # max-procs are "watchers" and the rest are "workers". See:
            # https://redmine.lighttpd.net/projects/1/wiki/frequentlyaskedquestions#How-many-php-CGI-processes-will-lighttpd-spawn 
            "max-procs" => 4, # default value
            "bin-environment" => (
                "PHP_FCGI_CHILDREN" => "1" # default value
            )
        )
    )   
)

Then I appended /etc/lighttpd/lighttpd.conf with the following text at the beginning.

include "conf.d/fastcgi.conf"

I then stopped and started lighttpd. However, when I browses to the machines IP it appears that lighttpd has crashed (I think) and no page is displayed (index.html or index.php).
If I run "systemctl status lighttpd.service"

Mar 30 21:51:39 KCARCHSVR systemd[1]: Started A secure, fast, compliant and very flexible web-server.
Mar 30 21:51:40 KCARCHSVR lighttpd-angel[2656]: 2014-03-30 21:51:40: (configfile.c.1272) a default document-root has to be set
Mar 30 21:51:40 KCARCHSVR lighttpd-angel[2656]: 2014-03-30 21:51:40: (server.c.649) setting default values failed
Mar 30 21:51:40 KCARCHSVR lighttpd-angel[2656]: lighttpd-angel.c.139: child (pid=2657) exited normally with exitcode: 255

If any body has any suggestions, I would be very grateful.
Kind Regards,

Harold Clements

Last edited by haroldjclements (2014-03-30 22:48:56)

Offline

Board footer

Powered by FluxBB