Monthly Archives: July 2012

Allow to use htaccess-like file to configure PHP in a suphp/CGI environment

Standard

In certain cases where we have the php compiled as cgi/Fastcgi,  we may be confused whether to configure php by means of .htaccess or custom php.ini. You can customize php parameters by installing htscanner in the server and customize php parameters by means of .htaccess.

====================

wget http://pecl.php.net/get/htscanner-1.0.1.tgz
tar -zxf htscanner-1.0.1.tgz
cd htscanner-1.0.1
phpize
./configure –enable-htscanner –with-php-config=/usr/local/bin/php-config
make
make install

Collect the extension_dir 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 then it will always comes to the default path( easyapache), so you don’t have to give extension_dir

Add the following line in a .htaccess and see if it works in a phpinfo page. Keep “Off” or “On” as needed.

<IfModule mod_php5.c>
php_value register_globals Off
</IfModule>

You can avoid adding ifmodule tag in .htaccess by enable htscanner module 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

/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
grep  mod_htscanner2.so /usr/local/apache/conf/httpd.conf
====================

mail sending failed by exim: The C compiler is not functional and auto repair failed.

Standard

I could not send mail from the server abd on restarting exim , it showed that the exim conf file is corrupted, so i tried to reinstall exim, by the command /scripts/eximup –force but that ended in the following error.
==================

TypeError: rpmdb open failed
** Unrecoverable Error **
The C compiler is not functional and auto repair failed.
Perl module installs require a working C compiler.
Please repair the C compiler and try again.

Indeed, it’s a corrupt rpm database.

===================

you can follow the below steps to resolve this issue.

1. Check for processes holding the rpm database open (usually in MUTEX/FUTEX states):

lsof | grep /var/lib/rpm

If it finds any, kill -9 them all.

2. Delete any temporary DB files:

rm -fv /var/lib/rpm/__*

3. Rebuild your RPM database:

rpm –rebuilddb -v -v

do /scripts/eximup –force

If you still have problems, a reboot is probably quickest, then repeat steps 2 and 3 above.

Brilliant! Fixed this and my exim problem.