problem with php-cgi started on another port

Discussion in 'Bug Reports' started by ts77, Jul 15, 2006.

  1. ts77

    ts77 Well-Known Member

    Hi there,

    some versions before you introduced the option to start a php-fastcgi handler with some options and later on to start it automatically.

    Since upgrading to 2.1.18 this doesn't seem to work anymore.
    I get *no* error message about this in the logs, just the php doesn't come up anymore. It seems like it simply doesn't start it or the php can't start because of a used socket.

    The configuration is as follows:

    When I try to start it manually I get
    /usr/lib/php5/bin/php-cgi -b
    Cannot bind/listen socket - [98] Address already in use.
    Couldn't create FastCGI listen socket on port
    netstat -anp|grep 1028
    netstat -anp|grep 1028
    tcp        0      0*               LISTEN      9897/lshttpd
    tcp     1201      0    CLOSE_WAIT  -
    tcp      689      0    CLOSE_WAIT  -
    tcp     1201      0    CLOSE_WAIT  -
    tcp      689      0    CLOSE_WAIT  -
    tcp     1201      0    CLOSE_WAIT  -
    tcp     1201      0    CLOSE_WAIT  -
    tcp     1201      0    CLOSE_WAIT  -
    tcp     1201      0    CLOSE_WAIT  -
    tcp        0      0     ESTABLISHED 9897/lshttpd
    Please help. I really need this working.
    I'll try to switch back to 2.1.17 in the meantime and see if this helps.

    Update: switching back to 2.1.17 worked and it started up the php-cgi on port 1028 without problems *sigh*.
  2. mistwang

    mistwang LiteSpeed Staff

    I think your memory limit is way too low. Due to a bug in earlier release, application specific resource limit has not been enforced. So that might be the cause.
    And, if you let LSWS start the FCGI directly, the "-b" command line option is not necessary.
  3. ts77

    ts77 Well-Known Member

    does lsws add the port on its own?
    I need to start it on a port to be able to use the php worker from a second server.
    Shouldn't there be some message if an app can't start because of the memory limit?
  4. mistwang

    mistwang LiteSpeed Staff

    Yes, when an application is started by Litespeed.
    Yes, here should be. You can check the stderr.log and error.log, some error messages are hard to catch. :)
  5. ts77

    ts77 Well-Known Member

  6. mistwang

    mistwang LiteSpeed Staff

    That's for starting PHP from command line, no need for starting from within LSWS.

    No message probably becuse no system call within LSWS was failed, just the kernel kills successfully spawned process due to the memory limits. ;)
  7. ts77

    ts77 Well-Known Member

    ok, it works now both without -b and with a memory limit in 2.1.18.
    why did no one tell me that its *bytes*, not *megabytes*? ;-)
    wouldn't it be worthwhile to add a shortcut to put in something like 250M ?

    may I ask whats the difference in the use of soft-limit and hard-limit is?
  8. Arkadius

    Arkadius Member

    is there any ENV Variables to set a different php.ini & user id / group id for such a process ?

  9. ts77

    ts77 Well-Known Member

    php-cgi --help
    Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>] 
           php <file> [args...]
      -a               Run interactively
      -b <address:port>|<port> Bind Path for external FASTCGI Server mode
      -C               Do not chdir to the script's directory
      -c <path>|<file> Look for php.ini file in this directory
      -n               No php.ini file will be used
      -d foo[=bar]     Define INI entry foo with value 'bar'
      -e               Generate extended information for debugger/profiler
      -f <file>        Parse <file>.  Implies `-q'
      -h               This help
      -i               PHP information
      -l               Syntax check only (lint)
      -m               Show compiled in modules
      -q               Quiet-mode.  Suppress HTTP Header output.
      -s               Display colour syntax highlighted source.
      -v               Version number
      -w               Display source with stripped comments and whitespace.
      -z <file>        Load Zend extension <file>.
    -c seems to help you for the php.ini.
    I don't know about any option to run it under a different user but I also never needed that.
  10. mistwang

    mistwang LiteSpeed Staff


    It is not controled by ENV variables. you have to define a vhost level lsphp application and set "CGI setuid mode" to "docroot uid"
  11. mistwang

    mistwang LiteSpeed Staff

    I think we will change the memory limit range, only >1M is allowed if it is not zero. ;)
    Please take a look "man 2 setrlimit".
  12. ts77

    ts77 Well-Known Member

    Good idea :). but no xM size? :(

    Thx, just for the record and maybe others searching for it:

Share This Page