SetEnv in .htaccess File
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:
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?
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?
-
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: 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. 0 -
For PHP 5.6 (the default), I'm using DSO. 0 -
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. 0 -
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 0 -
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.0 -
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, 0 -
Hello @salvazo, 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 documents: Environment Variables in Apache - Apache HTTP Server Version 2.4 You'll need to switch from CGI to different handler (e.g. suPHP) if you want to use SetENV in a similar fashion to before. Thank you. 0
Please sign in to leave a comment.
Comments
7 comments