Htscanner: Useful forenablingphpdirectivevalues in.htaccessinasuph.p/cgihandlerThatmeans, it allows to use htaccess-like file to configure PHPinasuphp/CGI environment.

Whenusingacgiversionofphp,apachecan’t passanyphpsettingsfromhtaccessfiles it parses. This can be solved by giving each user its own php.ini file, but It’s not a good solution.

 

This extension parses these configuration files (in most cases.ht  access) and changes the settings. It will search all directories for a configuration file from the docrootuntilthedirectory where the request script sis found.

Note: When you don’t load the mod_php module in apache, apache will give a 500 error when it finds an htaccess file with a php_* directive. You can prevent this by usingadiffirentfileforphporby putting:

IfModulemod_php5.c>

php_valuefoobar

</IfModule>

aroundthesettings. Thiswayapachewillignore them.

If for some reasons you like to allow your users to have.htaccessfiles without <IfModule mod_php5.c>,you can use the mod_htscanner.c (Apache 1.x) or mod_htscanner2.c (Apache 2.x) module provided with the package.

The latest htscannersoucecodeis available on  web sitehttp://pecl.php.net/package/htscanner

cd/usr/src

downloadhtscanner-1.0.1.tgz

tar -zxf htscanner-1.0.1.tgz

cdhtscanner-1.0.1

phpize

./configure–enable-htscanner–with-php-config=/usr/local/bin/php-config

make

makeinstall

Collect the extension_di from the “make install” output.

Add in php.ini

[htscanner]

extension= "htscanner.so"

config_file = “.htaccess”

default_docroot = “/”

default_ttl = 300

stop_on_error = 0

If you are using /usr/local/bin/php-config for –with-php-config thenitwillalwayscomestothe default path(easy apache), so you don’t have to give extension_dir

Add the following lineina.htaccessand see if itworksinaphpinfopage. Keep “Off” or “On” as needed.

php_value register_globals Off

You can avoid adding ifmoduletagin.htaccessbyeenablehtscannermodule for apache

Go to the unzipped package location

Make sure apache has mod_so

/usr/local/apache/bin/httpd -l | grep mod_so.c

mod_so.c

Compile the module by

cd/usr/local/src

downloadmod_htscanner2.c

/usr/local/apache/bin/apxs -c -a -imod_htscanner2.c

Restart apache

/usr/local/apache/bin/apachectl configtest

/usr/local/apache/bin/apachectl restart

/usr/local/cpanel/bin/apache_conf_distiller –update

grepmod_htscanner2.so /usr/local/apache/conf/httpd.conf

LoadModule htscanner_module modules/mod_htscanner2.so

+++++++++++++