SuExec Usage with LSAPI and dynamic command line Parameter

Discussion in 'Install/Configuration' started by benoit.georgelin, Jan 22, 2014.

  1. Hi Guys !

    I'm currently testing ListSpeed (Trial version)
    I run several Vhost from apache configuration (Loading Apache Config)
    I use SuExec

    Here is what I'm using with Apache2.2

    FCGIWrapper "/opt/wrapper/php ${PHP_VERSION} ${DOMAINE_NAME}"

    In any vhost , there is this line , for example with domain.com :

    FCGIWrapper "/var/tmp/wrapper php53 domain.com"

    This is explicitly written in the vhost file
    When domain.com is reach , Fastcgi is used to call /var/tmp/wrapper and send the command line parameter 1 (php53) et 2 (domaine.com)

    The wrapper file execute php-cgi or lsphp binary with a specific PHPRC variable value and/or explicitly give de php.ini file to use for this php version and this domain.

    I'm trying to find a work around to do that with LietSpeed when loading configuration from apache is enable.

    The solution without using the configuration from apache it to create all vhost into LiteSpeed, for each vhost create a External Application with the specific command line parameter. This is working like a charm.

    But I the case I wanna use the apache configuration I have no idea how to manage that.
    The only luck that I could have is passing $VH_NAME to the environment variable of the common external application used in dynamic configuration file from apache but this is not working (see my other post there: http://www.litespeedtech.com/support/forum/showthread.php?p=77057#post77057 )
    If at least I can have the domain name used in the request, I'll be able to manage to know the PHP_VERSION required bye the domaine.

    Thanks for you help :)
    Last edited: Jan 22, 2014
  2. NiteWave

    NiteWave Administrator

  3. NiteWave

    NiteWave Administrator

    how about PHPIniDir ?
    I think each subdomain can have its own php.ini with it.
  4. I need to be able to use different php.ini for domain and SUBdomain for same user.

    My understanding with PHPIniDir is that only works by system user.
    So if one user have 2 domains or 1 domain and 1 subdomain, they have to use the same PHPIniDir .

    Am I right ?
  5. NiteWave

    NiteWave Administrator

    looks you're right. in wiki's note:
    "PHPIniDir directive is effective ONLY IF placed in the 1st (or main domain) vhost OF THE ACCOUNT (USER). The one placed in subdomain vhost will be ignored even though it is just for that vhost."

    there is a new environment variable "PP_CUSTOM_PHP_INI" which not mention in wiki yet, you can try it, but I think it may not meet your requirement either.
    I think its usage is same as PHPIniDir

    maybe there is a way in current lsws just fit your case, but I'm not clear at the time being, since this is not frequently asked questions.(I think our other staff will answer it here if it's already there)

    current lsws's php configuration is already powerful enough. to my understanding,
    1)you can use multiple php versions in a vhost/subdomain, in directory level:
    http://www.litespeedtech.com/suppor...peed_wiki:multiple_phps_in_control_panel_lsws
    2)echo vhost can have its own php.ini, as we've discussed already:
    http://www.litespeedtech.com/suppor...speed_wiki:per_user_ini_in_control_panel_lsws
    3)following apache directives
    php_value
    php_flag
    php_admin_value
    php_admin_flag
    (http://www.php.net/manual/en/configuration.changes.php)
    works with lsws

    just FYI, to help you resolve the issue in the end.
  6. Thanks for your help.
    I'm gonna do some testing.

    I was just looking to use our existing Apache configuration with LiteSpeed without doing any modification on our existing files :)

    I'm agree with you sws's php configuration is already powerful enough.
    The Suexec part is not working out of the box with Apache existing configuration


    LiteSpeed is capable to do what I want, it's just not possible from Apache loaded configuration.

    Here is what I'm doing from Litespeed configuration :

    Code:
    <extProcessorList>
        <extProcessor>
          <type>lsapi</type>
          <name>lsphp5</name>
          <address>uds://tmp/$VH_NAME_lsphp5.sock</address>
          <note></note>
          <maxConns>35</maxConns>
          <env>PHP_LSAPI_MAX_REQUESTS=500</env>
          <env>PHP_LSAPI_CHILDREN=35</env>
          <initTimeout>60</initTimeout>
          <retryTimeout>0</retryTimeout>
          <persistConn></persistConn>
          <pcKeepAliveTimeout>120</pcKeepAliveTimeout>
          <respBuffer>0</respBuffer>
          <autoStart>1</autoStart>
          [B]<path>/opt/wrapper/php php53 domain.com</path>[/B]
          <backlog>100</backlog>
          <instances>1</instances>
          <extUser></extUser>
          <extGroup></extGroup>
          <runOnStartUp>0</runOnStartUp>
          <extMaxIdleTime>30</extMaxIdleTime>
          <priority></priority>
          <memSoftLimit></memSoftLimit>
          <memHardLimit></memHardLimit>
          <procSoftLimit>50</procSoftLimit>
          <procHardLimit>60</procHardLimit>
        </extProcessor>
      </extProcessorList>
    
    In that specific case, I cannot run LiteSpeed with Apache configuration without modify the existing configuration.

    This is very specific option to our configuration maybe and I understand ;)

    Thanks
  7. mistwang

    mistwang LiteSpeed Staff

    Your existing Apache configuration wont work with LiteSpeed.
    LiteSpeed only assign one group of PHP process per account to limit the resource usage. So, the php.ini setting has to be per account.
  8. Thanks for you answer.

    I'm now working with the LiteSpeed configuration.
    Here is what I'm doing, can you tell me what you think about it :


    1 Listener for every vhost
    1 Virtual Vhost configuration file by domain or sub domain
    1 External Apps declaration by Virtual Host with a unique name
    System Users are identical for domain and sub domain
    PHP Suexec is used and the External Apps call the app with specific parameters.

    With this configuration I'm able to run multiple vhosts with same user and php.ini different .
  9. NiteWave

    NiteWave Administrator

    this should work.

    however, how many domains + sub-domains are there ?
    if there are hundreds of them ...
  10. About 8.000

    Is there any concern doing that ?
  11. mistwang

    mistwang LiteSpeed Staff

    Create a external app for each vhost, you can do whatever you want. but a user with a lot of subdomain is able to start a lot more PHP processes. It might become a problem.
    But, if want per subdomain php.ini, there is no other way around it.
  12. Ok, thank you :)

Share This Page