grayloon

Well-Known Member
Oct 31, 2007
117
4
68
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?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
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.
 

salvazo

Member
May 2, 2011
20
1
53
Hi,

I have the same issue here.

How can I use SetEnv variables from .htaccess? I activate the "mod_env" module but still having troubles.

Any help?

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
How can I use SetEnv variables from .htaccess? I activate the "mod_env" module but still having troubles.
Hello @salvazo,

Can you verify which PHP handler is enabled for the version of PHP associated with that account? 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 .htaccess entry simply not utilized?

Thank you.
 

salvazo

Member
May 2, 2011
20
1
53
Hi Michael,

I have these two versions:

PHP 5.6 (ea-php56) - PHP Handler cgi
PHP 7.2 (ea-php72) - PHP Handler cgi

There is no specific error messages, simply the SetEnv from .htaccess is not set and I can't use them.

Thanks,
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463