LighTPD and PHP not working if outside of LightTPD folder

Posted by Marco83 on Server Fault See other posts from Server Fault or by Marco83
Published on 2012-11-30T16:15:08Z Indexed on 2012/11/30 17:05 UTC
Read the original article Hit count: 215

Filed under:
|
|

I need to set up a simple web server with PHP on Windows XP that a number of different people will use for local testing.

I'm using LightTPD 1.4.30-4-IPv6-Win32-SSL and PHP 5.2.

So far I've created this folder structure:

tools/
   LightTPD/
       htdocs/
   PHP/

I set up PHP as CGI and the document root as server_root + "/htdocs". It works fine (well, it's slow but I don't want to bother with FastCGI for now :) ).

My problem is when I try to put the htdocs outside of LightTPD folder, like this:

htdocs/
tools/
    LightTPD/
    PHP/

I update the document root to server_root + "/../../htdocs" and while static HTML pages work fine, PHP pages stop working (they return a "No input file specified"). I literally just change the document root, I didn't change anything in the php.ini or anywhere else. Please also note that I left all doc_root, user_dir and cgi.force_redirect to the default values in php.ini, and it works when htdocs is inside LightTPD, but not when I move it ouside.

Any idea of why it's breaking??

Here's my lightTPD.conf:

server.modules              = (
                            "mod_access",
                            "mod_accesslog",
                           "mod_alias",
                           "mod_cgi",
                            "mod_status",
                           )


include "variables.conf"
include "mimetype.conf"

# THIS WORKS
server.document-root        = server_root + "/htdocs"
# THIS DOESN'T
#server.document-root        = server_root + "/../../htdocs"

server.upload-dirs          = ( temp_dir )

index-file.names            = ( "index.php", "index.pl", "index.cgi", "index.cml",
                            "index.html", "index.htm", "default.htm" )

server.event-handler        = "libev"

url.access-deny             = ( "~", ".inc" )

$HTTP["url"] =~ "\.pdf$" {
    server.range-requests = "disable"
}

static-file.exclude-extensions = ( ".php", ".pl", ".cgi" )
server.errorlog = server_root + "/logs/error.log"

######### Options that are good to be but not neccesary to be changed #######

dir-listing.activate        = "enable"

#### CGI module
cgi.assign                 = ( ".php" => server_root + "/../PHP/php-cgi.exe" )

status.status-url           = "/server-status"
status.config-url           = "/server-config"

© Server Fault or respective owner

Related posts about php

Related posts about webserver