Now that you have followed our "How To Install Lighttpd Web Server In Linux" we are going to show you how to add PHP5 capabilities so you can run php scripts using lighttpd web server.

we will be editing two important files:
/etc/lighttpd/lighttpd.conf
and
/etc/php.ini

we are going to start by openeing /etc/php.ini - i am using CentOS to write this tutorial so i will use nano, you can us VI is you want as your text editor.
nano /etc/php.ini
add this at the last line of the file:
cgi.fix_pathinfo = 1 save the chances and now open the second file:
/etc/lighttpd/lighttpd.conf to edit:
nano /etc/lighttpd/lighttpd.conf

first, look for "mod_fastcgi" but sure to uncomment it [remove the # symbol at the begining of the line] should look like this: server.modules = (
"mod_rewrite",
#                               "mod_redirect",
#                               "mod_alias",
                                "mod_access",
#                               "mod_cml",
#                               "mod_trigger_b4_dl",
#                               "mod_auth",
#                               "mod_status",
#                               "mod_setenv",
                                "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
#                               "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog" )
then look for this :
#fastcgi.server             = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "socket" => "/var/run/lighttpd/php-fastcgi.socket",
#                                   "bin-path" => "/usr/bin/php-cgi"
#                                 )
#                               )
#                            )
uncomment all the lines so it should look like this:
fastcgi.server             = ( ".php" =>
                               ( "localhost" =>
                                 (
                                   "socket" => "/tmp/php-fastcgi.socket",
                                   "bin-path" => "/usr/bin/php-cgi"
                                 )
                               )
                            )
NOTE: be sure that the socket and bin-path match how mine looks now you can restart lighttpd
/etc/init.d/lighttpd restart