Does anyone know if you can override a ProxyFCGISetEnvIf directive in a directory section? The documentation for apache's mod_proxy_fcgi says it is valid in a section, but I'm not seeing the ProxyFCGISetEnvIf apply when in the directory.
Here's an example:
<VirtualHost *:443>
ServerName test7.com
ServerAlias
DocumentRoot /var/www/test
ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001/var/www/test/$1
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=/var/www/test:/usr/share/php:/usr/share/pear \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"
<Directory "/var/www/test/cooldir">
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=/var/www/test:/var/www:/usr/share/php:/usr/share/pear \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"
</Directory>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/test7.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test7.com/privkey.pem
</VirtualHost>
When I'm in the "cooldir" directory, phpinfo() is showing the that the open_basedir variable value did not change. So, what's the hierarchy for ProxyFCGISetEnvIf values in mod_proxy_fcgi? I would imagine it should work like nginx with specific directory declarations overriding the top level. For example, in nginx, this works:
location /cooldir {
root /var/www/test/;
index index.php index.html index.htm;
location ~ ^/cooldir/(.+\.php)$ {
try_files $uri =404;
root /var/www/test/;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PHP_ADMIN_VALUE "open_basedir=/var/www:/tmp:/usr/share:/var/www/php_sessions \n upload_tmp_dir=/tmp \n session.save_path=/var/www/php_sessions";
include /etc/nginx/fastcgi_params;
limit_req zone=one burst=5;
}
}
Any help is appreciated.
You have to use a <Location> directive instead of a <Directory> directive according to a response I received on the apache users mailing list:
<Location "/webmail">
ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=/var/lib/roundcube:/etc/roundcube:/usr/share:/tmp:/var/www/php_sessions:/var/log/roundcube; \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"
</Location>