The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SetEnv not working?

Discussion in 'General Discussion' started by hectorpn, Nov 27, 2011.

  1. hectorpn

    hectorpn Member

    Joined:
    Sep 23, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    Hi everyone,

    I have a Magento multi-store on one server (WHM, Apache 2 with NGINX proxy, eAccelerator) and use SetEnv to handle multiple stores each using separate domains, like this:

    SetEnvIf Host .*domain.* MAGE_RUN_CODE=cs
    SetEnvIf Host .*domain.* MAGE_RUN_TYPE=website

    It works perfectly fine.

    I just copied the entire cPanel account to another server (Apache 2 with NGINX proxy and NO eAccelerator or FGCI) and this has stopped to take any effect. I am stumped. Is there a WHM setting that disabled SetEnv? I have been struggling for hours and can't understand why it works on the other server and not on this one, when all files and DB are identical.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    What is the PHP handler on this new machine? I'm not certain I understand the PHP handler you are using on the old machine versus the new machine.
     
  3. hectorpn

    hectorpn Member

    Joined:
    Sep 23, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    The old machine:

    - Apache 2.2
    - PHP5 (5.3.6)
    - Handler fcgi / Mod FCGID
    - suEXEC
    - Safe Mode off
    - MPM Worker


    The new machine:

    - Apache 2.2
    - PHP5 (5.3.6)
    - Handler cgi
    - suEXEC
    - Safe Mode off
    - MPM Prefork
    - Mod Version and Mod Asis disabled


    Those are all differences I can find. Don't know if there is a tweak that disabled SetEnv in WHM?

    I purposedly entered a wrong regex on the htaccess (SetEnvIf Host *domain* MAGE_RUN_CODE=cs) and the website returned an error 500, as expected. So it means it must be reading the switch, at least when it is wrong.
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Could you switch to something other than cgi on that new machine? CGI is the slowest of the 4 PHP handlers, so I'm confused why it would be used. It would be ideal to use the same setup as on the old machine if at all possible for each setting.
     
  5. hectorpn

    hectorpn Member

    Joined:
    Sep 23, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    Yes I tried for so long to make it use fcgi / eAccel but just gave up. That server sells BIG digital downloads (up to 4GB videos) so NGINX or WORKER or someone in the chain who after literally days of testing I couldn't nail, was timing out or maxing out. I increased the PHP max execution time to ridiculous amounts, same thing for the fcgid request lengths etc etc. So, against my will I had to switch to the good ol' CGI.
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Have you considered running DSO on that machine with mod_ruid2 to determine who is running processes, which would allow DSO to be more like suPHP, CGI and FCGI for tracking users? DSO would be a lot faster. CGI is even slower than suPHP would be.

    If you did switch it back to FCGI temporarily, does SetEnv work?
     
  7. hectorpn

    hectorpn Member

    Joined:
    Sep 23, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    For a reason that escapes me right now I believe DSO broke theWordpress websites?

    Not familiar with mod_ruid2?

    Haven't tried switching back to fcgid, to be honest. The server is productive so I'd try to mess with it as little as possible unless I am certain something hidden is not going to break.
     
  8. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If you cannot troubleshoot for a 5-10 minute period during a slow server time to see if changing a setting will get SetEnv working, then it would be difficult to track down the cause.
     
  9. hectorpn

    hectorpn Member

    Joined:
    Sep 23, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    No, yes I am "happy" (yay!) to troubleshoot, just as long as it has a purpose. I wouldn't have thought of switching to FGID, for example.

    Anyways, it's been quite a while since I last fiddled with the handlers. Which one, other than CGI and FCGI would support Wordpress and the likes? DSO doesn't, as far as I recall?

    Will suPHP handle htaccess directives such as the rewrites and SetEnv needed for MAgento, Wordpress, etc?
     
  10. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    suPHP should handle all of the directives that CGI and FCGI allow for rewrites in .htaccess files. It should also use approximately the same file and ownership permissions set that CGI and FCGI use.
     
  11. hectorpn

    hectorpn Member

    Joined:
    Sep 23, 2010
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    OK I rebuilt Apache with suPHP and at least the SetEnv are now working... who would've thought.

    It is not letting me add mod_cloudflare.so in the Pre Virtual Hosts, but I'll open a separate thread for that. Now to make sure nothing else broke in the process.

    Thanks a lot Tristan. This forum does surprise me with the speed and depth of the support, cheers.
     
Loading...

Share This Page