First, install htscanner from WHM > Module Installers > PHP Pecl > htscanner
This will allow php_value and php_flag to work with php.
Next for it to also work with Apache without the need to use ifmodule
# cd /usr/src/
# wget http://pecl.php.net/get/htscanner-1.0.1.tgz
# tar -zxf htscanner-1.0.1.tgz
# cd htscanner-1.0.1
IMPORTANT: Make sure apache has mod_so and then proceed remaining steps
# /usr/local/apache/bin/httpd -l | grep mod_so.cmod_so.c
Compile the module by
/usr/local/apache/bin/apxs -c -a -i mod_htscanner2.c
Restart apache
# /usr/local/apache/bin/apachectl configtest
# /usr/local/apache/bin/apachectl restart
# /usr/local/cpanel/bin/apache_conf_distiller –update
And a final check
# grep mod_htscanner2.so /usr/local/apache/conf/httpd.confLoadModule htscanner_module modules/mod_htscanner2.so
php_value and php_flag should now be working fine in .htaccess