CHENG LIANG | 18 Oct 23:07
Picon
Favicon

Re: (no subject)

Shame is not for you! Be a cool man!.. http://jadecom.net/com.page.php?luzID=41co5
_______________________________________________
FastCGI-developers mailing list
FastCGI-developers@...
http://mailman.fastcgi.com/mailman/listinfo/fastcgi-developers
Howard May | 17 Aug 16:10
Favicon

Manually spawned process and unix domain sockets

I have the following requirements which I am struggling to meet:

 

1)       Use UNIX domain sockets (named pipes) to communicate (they are on the same box)

2)       Have a single instance of both lighttpd and myApp running

3)       Have multiple simultaneous requests forwarded from Lighttpd at a time

 

I have a robust setup which uses TCP connections and works very well. This uses the FCGX API to allow myApp to receive multiple requests simultaneously. All I am trying to do is port this from using tcp connections to using named pipes. But I have as yet failed to make this work.

 

I have now reverted to a simple test app which I have included below along with my Lighttpd config snipet.

I have set the ownership of everything in a ten mile radius to ‘lighttpd’

 

I would be very grateful for any help or suggestions as to what might be going wrong.

 

Best Regards

 

Howard May

 

P.S. Konstantin, I have BCCed you explicitly as you had previously offered assistance in this area (back in 2009!)

 

 

fastcgi.server    = ( "/namedpipetest/" =>

                      (

                        (

                          "socket" => "/var/tmp/lighttpd/wsi-fastcgi.socket",

                          "check-local" => "disable"

                        )

                      )

                    )

 

 

 

#include <stdio.h>

#include "fcgiapp.h"

 

void main(int argc, char ** argv)

{

  int fd;

  int result;

  FCGX_Request req;

  printf("Fastcgi FIFO test app\n");

  result = FCGX_Init();

  if(result != 0)

  {

    printf("FCGX_Init returned %d\n", result);

    return;

   }

  fd = FCGX_OpenSocket("/var/tmp/lighttpd/wsi-fastcgi.socket", 16);

  if(fd == 0)

  {

    printf("FCGX_OpenSocket returned 0\n");

    return;

  }

  FCGX_InitRequest(&req, fd, 0);

 

  while((result = FCGX_Accept_r(&req))==0);

  {

    FCGX_FPrintF(req.out, "Content-type: text/html\r\n\r\n<TITLE>Whoop</TITLE>\n");

  }

  printf("FCGX_Accept_r returned %d\n", result);

  return;

}

 

 

_______________________________________________
FastCGI-developers mailing list
FastCGI-developers@...
http://mailman.fastcgi.com/mailman/listinfo/fastcgi-developers
Dean Banks | 12 Jul 16:40
Picon

How to detect closed connection

Hi all,

I have a FCGI application written in C. We have cases where a client closes an active connection--i.e. leaves the page during page load--which we'd like to detect within the application, if possible. We have our web server (nginx) configured to close the FCGI connection when the client connection is unexpectedly closed, so my hope is that by looking at the FCGI stream state at the end of the transaction, we might be able to detect a client-initiated closed connection.

My question is: Is it possible to detect this using FCGX_GetError() on the output stream right before calling FCGX_Finish_r() ? If not, how might I trap such a condition.

Cheers.
_______________________________________________
FastCGI-developers mailing list
FastCGI-developers@...
http://mailman.fastcgi.com/mailman/listinfo/fastcgi-developers
David Birnbaum | 18 May 16:40

Dev Mailing List

Folks,

I think the mailing lists and archives are all fixed up now.  I also 
opened the archives up so they can be Google-searched (thanks to the 
person who pointed that out).  The wiki and web site will be migrating 
shortly as well as soon as I get a chance to finish setting up and 
securing httpd and the Drupal stuff.

   http://mailman.fastcgi.com

Should be the right URL (and properly propagate now as well).

Cheers,

David.
Henry C. | 5 May 13:36
Picon

Trying to use FastCGI to run PHP as UID of file owner

Hi there,

PHP:  5.3.3
Apache: 2.2.17
mod_fastcgi: 2.4.6

I'm trying out FastCGI for the first time, so please forgive my ignorance.

Basically, I'm trying to use FastCGI to run PHP scripts as the UID/owner of
the script itself, not the default apache 'nobody'/etc.

I must be missing a few things because I'm running into a few problems and
would appreciate *any* pointers.

Here's my apache config for a virtual host:

<VirtualHost ...>
 <IfModule mod_fastcgi.c>
  FastCgiServer /www/virtual/abc.com/cgi-bin/php
  AddHandler php-fastcgi .php
  SetHandler fastcgi-script
  Action php-fastcgi /cgi-bin/php
  AddType application/x-httpd-php .php
  <Directory /www/virtual/abc.com/htdocs>
      Options +ExecCGI
  </Directory>
 </IfModule>
 php_flag engine off
 Options +IncludesNOEXEC -Indexes +FollowSymLinks
 ServerAdmin webmaster@...
 DocumentRoot /www/virtual/abc.com/htdocs/index.html  # or without index.html
 php_admin_value open_basedir /www/virtual/abc.com/htdocs:/tmp
 php_admin_value display_errors on
 ServerName www.abc.com
 ServerAlias abc.com
 ErrorLog /www/virtual/abc.com/logs/error_log
 TransferLog /www/virtual/abc.com/logs/access_log
 ScriptAlias /cgi-bin/ /www/virtual/abc.com/cgi-bin/
</VirtualHost>

/cgi-bin/php file:
------------------
#!/bin/sh

PHPRC="/usr/local/php5/lib"
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
exec /usr/local/php5/bin/php

/cgi-bin/php is +x (executable) owned by root.

Test PHP script: /htdocs/1.php is owned by UID/GID 20964:2374 (ie, not the
apache user).  Perms are 775 (-rwxrwxr-x).

If I browse to abc.com/1.php it hangs for 30s, producing this error in the logs:

FastCGI: comm with (dynamic) server "/www/virtual/abc.com/htdocs/1.php"
aborted: (first read) idle timeout (30 sec)
FastCGI: incomplete headers (0 bytes) received from server
"/www/virtual/abc.com/htdocs/1.php"

It's almost as if /cgi-bin/php is not being fed the 1.php file and it's
waiting for input from stdin (which is what the php CLI binary does if you run
it without args).  It then times out waiting for input, producing the error
above.

I've configured/compiled PHP 5.3.3 with/without '--with-fastcgi' (even though
./configure --help does not show --with-fastcgi as being available).

I used 'top_dir = /.../apache/httpd-2.2.17' in the Makefile for
mod_fastcgi-2.4.6.  Your site talks about a php binary version which talks the
FastCGI protocol, so I'm not sure whether my PHP binary is compiled correctly
to work with FastCGI (the binary produced appears to be the same with/without
'--with-fastcgi, so this might be a factor).

Also, since this setup is intended for a customer, and they only have FTP
access to update their site, with CHMOD disabled, is there any way to do this
without having to make the PHP script executable?  If I turn off the
executable bit, then I get the "execute not allowed" (for uid 99, gid 99, ie,
the apache user) error which I suppose is expected.

A side-effect of all this is that I cannot even browse to an HTML file
(index.html) - it produces the error:

FastCGI: invalid (dynamic) server "/www/virtual/abc.com/htdocs/index.html":
access for server (uid 99, gid 99) not allowed: execute not allowed

Or it tries to execute the htdocs/ directory if I leave out the index.html for
DocumentRoot:

FastCGI: invalid (dynamic) server "/www/virtual/abc.com/htdocs/": script is a
directory!

I hope I've made sense in the above.  Any assistance/pointers would be
appreciated.  btw, it's a pity this mailing list is not open to google, else
I'd be able to search it for suggestions...

regards
Henry
Picon

multiple connections to a fastcgi server

Hello,

I want to build a fast cgi server application which can handles long
polling calls. There should be only one process of this fast cgi app
which handles all incoming requests.
I wrote an app which is similar to the threaded.c example in the fast
cgi sdk. (http://www.fastcgi.com/devkit/examples/threaded.c)
Before responding, my app will wait a certain time after an incoming
request. (For testing I only put a sleep() call above
FCGX_FPrintF(...) in threaded.c).
I tested with Lighttpd und nginx and got the same result: The second
call is blocked until the first one is finished. I think the method
FCGX_Accept_r(&request); blocks until FCGX_Finish_r(&request); is
called.
Does anyone has a running multithread fastcgi app?

Thanks
Marc
Nidhin M D | 25 Apr 08:47

Cannot allocate memory


Hi


Please help me to fix this issue.


[Wed Apr 20 14:28:39 2011] [notice] mod_fcgid: call /var/www/vhosts/domain.com/httpdocs/index.php with wrapper /usr/bin/php-cgi

[Wed Apr 20 14:28:39 2011] [error] (12)Cannot allocate memory: mod_fcgid: can't create wrapper process for /var/www/vhosts/domain/httpdocs/index.php

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Site hosted with plesk control.


Below is the server settings.


vi /etc/httpd/conf.d/fcgid.conf


 added by psa-mod-fcgid-configurator
LoadModule fcgid_module /usr/lib64/httpd/modules/mod_fcgid.so

<IfModule mod_fcgid.c>
  SocketPath /var/lib/httpd/fcgid/sock
</IfModule>

# added by psa-mod-fcgid-configurator
<IfModule mod_fcgid.c>
  IdleTimeout 36000
  ProcessLifeTime 7200
  MaxProcessCount 64
  DefaultMaxClassProcessCount 8
  IPCConnectTimeout 300
  IPCCommTimeout 450
  DefaultInitEnv RAILS_ENV production
</IfModule>


For solving some other issue with fcgid, created a new vhost.conf and vhost_ssl.conf then added below entries to files.


<IfModule mod_fcgid.c>
SocketPath /var/lib/httpd/fcgid/sock
IdleTimeout 3600
ProcessLifeTime 7200
MaxProcessCount 1000
DefaultMinClassProcessCount 3
DefaultMaxClassProcessCount 100
IPCConnectTimeout 8
IPCCommTimeout 600
BusyTimeout 300
</IfModule>


All these settings done before 2- 3 months. Drupal is used for building the sites. But now i'm getting errors i posted above. 

Total memory - Mem:   1984536k total

Please help. 


Regards

Nidhin M D

_______________________________________________
FastCGI-developers mailing list
FastCGI-developers@...
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers
furroy | 22 Apr 02:32
Picon

Looking for help configuring an application server

I have a dedicated application server. Whenever I push out an update to my product, there's a massive spike demand of PHP calls and it starts getting the dreaded 502 errors.  I'm trying to figure out the best way to configure this box to avoid these at all costs.  It's fine if the box gets bogged down and it just just takes longer to process the requests, speed isn't a big deal for this application, but getting back 502's causes me great pain on the front end.

RAM: 4 GB, Disk: 500 GB

CPUs: 1 (2 cores/CPU) <at> 2.2GHz

I cranked up PHP_FCGI_CHILDREN = 128 for my last test.  I don't care how much RAM this takes up (~3.5G), this box is solely dedicated to this service, there's nothing else running on it.   It still returned ~5500 502 errors during my load test.


Running nginx 0.8.53

PHP 5.2.15 (cli) (built: Dec 15 2010 14:09:31)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
    with XCache v1.2.2, Copyright (c) 2005-2007, by mOo
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies


_______________________________________________
FastCGI-developers mailing list
FastCGI-developers@...
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers
Howard May | 21 Apr 10:48
Favicon

libfcgi with fd > 1024

I am using Lighttpd with a fastCGI client using libfcgi on Linux. If Lighttpd opens more than 1024 tcp connections it seems that libfcgi fails and I believe this is on account of using ‘select’ with the default FD_SETSIZE value of 1024.

 

My question is whether this is a known issue with a tried and tested work around.

Note: my application is required to support more than 1024 simultaneous HTTP requests.

 

Best regards

 

Howard May

_______________________________________________
FastCGI-developers mailing list
FastCGI-developers@...
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers
Creat Adict | 18 Apr 10:28
Picon

PHP5-CGI load balancing

_______________________________________________
FastCGI-developers mailing list
FastCGI-developers@...
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers
steve arroyo | 7 Apr 22:22
Picon
Favicon

How to build mod_fastcgi.so on RHEL Server 5.6

/usr/sbin/apxs -o mod_fastcgi.so -c *.c

Doesn't generate a mod_fastcgi.so file

It generates these files:
mod_fastcgi.la
mod_fastcgi.lo
mod_fastcgi.o
mod_fastcgi.slo

Using instructions for shared object here:  http://www.fastcgi.com/mod_fastcgi/INSTALL

OS = RHEL 5.6  64-bit
Intel(R) Xeon(R) CPU           E5410  <at> 2.33GHz stepping 06
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
Server version: Apache/2.2.3
PHP 5.2.17

_______________________________________________
FastCGI-developers mailing list
FastCGI-developers@...
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers

Gmane