Project

General

Profile

Bug #2033

spaw-fcgi chmod: Invalid argument

Added by nemo about 8 years ago. Updated about 8 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Target version:
Start date:
2009-07-15
Due date:
% Done:

100%

Estimated time:

Description

Hi,
I have a strange problem with configuration/running the lighttpd and/or spawn-fcgi precesses.
When lighttpd and spawn-fcgi are configured for using proxy-core.backends = ( "127.0.0.1:1026" ) then all works fine except file uploading.
I am starting spawn-fcgi by this command:

/usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 1026 -f "/usr/local/bin/php-fastcgi -c /var/www/conf/" -C 16 -P /var/run/lighttpd/spawn-fcgi.pid

File upload works for very small files like 14kB, but files for eg. 2M are not properly uploaded - file is send to server but is not send to php script (small files are properly handled).

When I switch lighttpd and spawn to use unix socket (in lighttpd config: proxy-core.backends = ( "unix:/var/run/lighttpd/php-fastcgi.socket" )) file upload works OK for files of every weight, but there are another strange problem: php can not use mail() function - script just hangs.
I have to run spawn by command:

sudo -u _lighttpd /usr/local/bin/spawn-fcgi -s /var/run/lighttpd/php-fastcgi.socket -f "/usr/local/bin/php-fastcgi -c /var/www/conf/" -u _lighttpd -U _lighttpd -C 16 -P /var/run/lighttpd/spawn-fcgi.pid

because without the sudo appears error: spawn-fcgi: couldn't chmod socket: Invalid argument.

Please help me to solve this problem - I do not wont go back to apache ;)

ps. Sorry for my imperfect English.

Configuration on my box:
System: OpenBSD 4.5
web server: lighttpd 1.5 (configured with: ./configure --without-bzip2 --with-openssl --with-zlib)
spawn-fcgi 1.6.2
PHP: PHP 5.2.8 with Suhosin-Patch 0.9.6.3 (cgi-fcgi) (built: Mar 1 2009 15:20:31) Zend Engine v2.2.0, with Suhosin v0.9.27
lighttpd configuration (options which are set):

server.modules              = (
                                "mod_rewrite",
                                "mod_redirect",
                                "mod_alias",
                                "mod_access",
#                               "mod_trigger_b4_dl",
#                               "mod_auth",
                                "mod_status",
                                "mod_setenv",
                                "mod_proxy_core",
                                "mod_proxy_backend_http",
                                "mod_proxy_backend_fastcgi",
                                "mod_cgi",
                                "mod_simple_vhost",
                                "mod_evhost",
#                               "mod_userdir",
                                "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
                                "mod_secdownload",
                                "mod_rrdtool",
                                "mod_accesslog",
                                "mod_uploadprogress" 
#                               "mod_evasive" 
                              )
server.document-root = "/var/www/htdocs" 

#poll, kqueue, select
server.event-handler   = "poll" 

#writev, posix-aio, gthread-aio
server.network-backend = "writev" 
server.errorlog = "/var/lighttpd_log/lighttpd.error.log" 

# files to check for if .../ is requested
index-file.names  = ( "index.php", "index.html",
                      "index.htm", "default.htm" )
mimetype.assign             = (
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
...........................
mimetype.use-xattr = "enable" 

## send a different Server: header
## be nice and keep it at lighttpd
server.tag = "lighttpd" 
accesslog.filename = "/var/lighttpd_log/access.log" 

## deny access the file-extensions
#
# ~    is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be part
#      of the document-root
#url.access-deny             = ( "~", ".inc" )
url.access-deny             = ( "~", ".xml")

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

##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".cgi" )
#server.error-handler-404   = "/error-handler.html" 
server.error-handler-404   = "/404.php" 

## to help the rc.scripts
server.pid-file = "/var/run/lighttpd/lighttpd.pid" 
dir-listing.activate     = "enable" 
debug.log-file-not-found          = "enable" 
debug.log-request-header-on-error = "enable" 
#### compress module
compress.cache-dir = "/var/lighttpd/cache/" 
compress.filetype = ("text/plain", "text/html", "text/javascript")

$HTTP["url"] =~ "\.php$" {
  proxy-core.balancer = "round-robin" 
  proxy-core.protocol = "fastcgi" 
  proxy-core.backends = ( "127.0.0.1:1026" )
  proxy-core.max-pool-size = 16
}

$PHYSICAL["existing-path"] =~ "\.php$" {
   proxy-core.balancer = "round-robin" 
   proxy-core.protocol = "fastcgi" 
   proxy-core.allow-x-sendfile = "enable" 
   proxy-core.allow-x-rewrite = "enable" 
   #proxy-core.backends = ( "unix:/var/run/lighttpd/php-fastcgi.socket" )
   proxy-core.backends = ( "127.0.0.1:1026" )
   proxy-core.max-pool-size = 16
   proxy-core.rewrite-request = (
   "_pathinfo" => ( "\.php(/.*)" => "$1" )
   )
}
#### CGI module
cgi.assign = ( ".pl"  => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" )

$SERVER["socket"] == "192.168.10.10:443" {
  ssl.engine                  = "enable" 
  ssl.pemfile                 = "/etc/ssl/server.pem" 
  ssl.ca-file                 = "/etc/ssl/server.crt" 
  #ssl.use-sslv2               = "disable" 
  server.name                 = "www.ybka.com" 
  server.document-root        = "/var/www/htdocs/" 
  setenv.add-environment      = ("HTTPS" => "on")
}

Associated revisions

Revision 52 (diff)
Added by stbuehler about 8 years ago

Fix Invalid Argument in chmod if mode=-1 (fixes 2033)

History

#1 Updated by nemo about 8 years ago

One more information: directory /var/run/lighttpd has set owner and permissions:

drwxr-xr-x   2 _lighttpd   wheel     512 Jul 15 17:45 lighttpd 

Best regards,
Artur

#2 Updated by stbuehler about 8 years ago

  • Subject changed from Strange problem with spawn-fcgi to spaw-fcgi chmod: Invalid argument
  • Priority changed from Urgent to Normal
  • Target version set to 1.6.3

If you try

sudo spawn-fcgi -u _lighttpd -U _lighttpd -s /var/run/lighttpd/php-fastcgi.socket -- /usr/local/bin/php-fastcgi -c /var/www/conf/

you may get the chmod error (linux doesn't about care chmod("...", -1), but i guess OpenBSD doesn't like that).

#3 Updated by stbuehler about 8 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r52.

Also available in: Atom