Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SetEnv in .htaccess File

Discussion in 'EasyApache' started by grayloon, Jul 16, 2018.

Tags:
  1. grayloon

    grayloon Well-Known Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes Received:
    2
    Trophy Points:
    68
    Location:
    Evansville, IN
    cPanel Access Level:
    Root Administrator
    Twitter:
    I just transferred a site from an EA3 server running Apache 2.2 and PHP 5.6 to an EA4 server running Apache 2.4 and PHP 5.6. In the .htaccess file for this site, there's a SetEnv declaration:

    Code:
    SetEnv APPLICATION_ENV production
    It works on the old server but not on the new server. httpd -M shows that env_module (shared) + setenvif_module (shared) are loaded.

    Is there some other way I can use SetEnv for PHP for single user?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,323
    Likes Received:
    1,851
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @grayloon,

    Apache 2.4 includes some security improvements to prevent certain types of attacks (e.g. cross-site-scripting). You can read more about this on the following document:

    https://httpd.apache.org/docs/2.4/howto/cgi.html#missingenv
    https://httpd.apache.org/docs/2.4/env.html#examples

    Are you using CGI as the PHP handler for the version of PHP associated with that account? You can confirm this via the "PHP Handlers" tab in WHM >> MultiPHP Manager. If so, you may want to switch over to suPHP as the PHP handler to verify if the issue persists.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. grayloon

    grayloon Well-Known Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes Received:
    2
    Trophy Points:
    68
    Location:
    Evansville, IN
    cPanel Access Level:
    Root Administrator
    Twitter:
    For PHP 5.6 (the default), I'm using DSO.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,323
    Likes Received:
    1,851
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @grayloon,

    Are you able to temporarily switch over to suPHP to see if the problem persists? If it does, can you provide some more information about what's happening? For instance, are there are any specific error messages logged to the error_log file within the document root of the script, or in the Apache error log? Or, is the value simply not utilized?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice