Project

General

Profile

Actions

Bug #2460

closed

(mod_cgi.c.1041) chdir failed: no such file or directory index.php

Added by jeisom over 11 years ago. Updated about 8 years ago.

Status:
Fixed
Priority:
Normal
Category:
mod_cgi
Target version:
ASK QUESTIONS IN Forums:

Description

I am using php with pdirl and am getting
(mod_cgi.c.1041) chdir failed: no such file or directory index.php
it appears to be trying to chdir into a file. This is on an embedded system.

pdirl can be found here.
http://pdirl.newroots.de/


Files

lighttpd.conf (10.7 KB) lighttpd.conf jeisom, 2012-11-16 19:36
cgi.conf (959 Bytes) cgi.conf jeisom, 2012-11-16 19:36
Actions #1

Updated by stbuehler over 11 years ago

  • Status changed from New to Need Feedback

You mapped the request to the filename "index.php/$something"; I have no idea how you did that (usually all pathnames are absolute, i.e. should start with "/").

Try

debug.log_request_handling = "enabled" 

and check DebugVariables

Actions #2

Updated by gstrauss about 8 years ago

The attached lighttpd.conf contains

var.server_root = "/" 

and later
server.document-root = server_root

(This makes more sense if I also mention that the attached lighttpd.conf contains:
server.chroot   = "/usr/local/apache2/webdav/usrfolder/" 

Therefore, the bug in mod_cgi is that it does c = strrchr(path, '/') and, in addition to checking if c is NULL, needs to check if c path. If c path, then chdir("/"), else temporarily set c = '\0' and chdir(path)

Created pull request https://github.com/lighttpd/lighttpd1.4/pull/18 with fix.

As an aside, while not the issue in this ticket, the chroot setting appears to conflict with

server.upload-dirs = ( "/usr/local/apache2/webdav/usrfolder/tmp" )

Within the chroot, server.upload-dirs should probably be
server.upload-dirs = ( "/tmp" )

Actions #3

Updated by stbuehler about 8 years ago

  • Status changed from Need Feedback to Fixed
  • % Done changed from 0 to 100

Applied in changeset r3077.

Actions #4

Updated by stbuehler about 8 years ago

  • Target version set to 1.4.40
Actions

Also available in: Atom