problem with php-cgi started on another port

ts77

Well-Known Member
#1
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
Code:
/usr/lib/php5/bin/php-cgi -b 192.168.115.10:1028
Cannot bind/listen socket - [98] Address already in use.
Couldn't create FastCGI listen socket on port 192.168.115.10:1028
netstat -anp|grep 1028
returns
Code:
netstat -anp|grep 1028
tcp        0      0 192.168.115.10:1028     0.0.0.0:*               LISTEN      9897/lshttpd
tcp     1201      0 192.168.115.10:1028     192.168.115.10:57867    CLOSE_WAIT  -
tcp      689      0 192.168.115.10:1028     192.168.115.10:35652    CLOSE_WAIT  -
tcp     1201      0 192.168.115.10:1028     192.168.115.10:37713    CLOSE_WAIT  -
tcp      689      0 192.168.115.10:1028     192.168.115.10:35445    CLOSE_WAIT  -
tcp     1201      0 192.168.115.10:1028     192.168.115.10:37509    CLOSE_WAIT  -
tcp     1201      0 192.168.115.10:1028     192.168.115.10:36752    CLOSE_WAIT  -
tcp     1201      0 192.168.115.10:1028     192.168.115.10:35005    CLOSE_WAIT  -
tcp     1201      0 192.168.115.10:1028     192.168.115.10:58108    CLOSE_WAIT  -
tcp        0      0 192.168.115.10:42646    192.168.115.11:1028     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*.
 

mistwang

LiteSpeed Staff
#2
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.
 

ts77

Well-Known Member
#3
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?
 

mistwang

LiteSpeed Staff
#6
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. ;)
 

ts77

Well-Known Member
#7
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?
 

ts77

Well-Known Member
#9
Code:
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.
 

mistwang

LiteSpeed Staff
#10
Arkadius,

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

ts77

Well-Known Member
#12
mistwang said:
I think we will change the memory limit range, only >1M is allowed if it is not zero. ;)
Good idea :). but no xM size? :(

Please take a look "man 2 setrlimit".
Thx, just for the record and maybe others searching for it:
The soft limit is the value that the kernel enforces for the corre-
sponding resource. The hard limit acts as a ceiling for the soft
limit: an unprivileged process may only set its soft limit to a value
in the range from 0 up to the hard limit, and (irreversibly) lower its
hard limit. A privileged process (under Linux: one with the
CAP_SYS_RESOURCE capability) may make arbitrary changes to either limit
value.
 
Top