web analytics

Monthly Archives July 2014

Enabling detailed debug log in imap

Sometimes your might need to check for detailed logging in email. One of my friends was  developing an email application and he wanted to check what was happening behind the screen when he received an email, moves it to another folder, deletes it etc.

Hence, we decided to enable detailed logging in imap. It was a cpanel server and we used the option imapdebug. Always keep a backup of the file you edit.

root@abc# cp -pv /usr/lib/courier-imap/etc/imapd /usr/lib/courier-imap/etc/imapd.bak.$(date +%F)

root@abc# vi /usr/lib/courier-imap/etc/imapd

Now uncomment the following line.

IMAPDEBUGFILE=”imaplog.txt”

Now touch a file named  imaplog.txt at the root of the account where you want to enable logging. Restart the courier service. Suppose I need to enable logging for greproot@abc.com.

root...

Read More

(28)No space left on device: mod_rewrite: Parent could not create RewriteLock file

Noticed this error in a cpanel server while starting apache. Apache refused to start with the following error.

(28)No space left on device: mod_rewrite: Parent could not create RewriteLock file

Seeing the error, the first thing that I checked was the disk space in the server but it looked fine.

root@abc [~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root   16G  1.2G   14G   8% /
/dev/mapper/vg0-home  249G  124G  113G  53% /home
/dev/mapper/vg0-var    23G  7.0G   15G  33% /var
/dev/mapper/vg0-usr    23G  7.6G   14G  36% /usr
/dev/mapper/vg0-tmp   9.5G  151M  8.9G   2% /tmp
/dev/sda1             7.4G  184M  6.9G   3% /boot
tmpfs                 7.9G     0  7...

Read More

PHP Warning: mysql_connect(): No such file or directory

I was getting the following error while trying out a basic mysql connection script.

PHP Warning: mysql_connect(): No such file or directory

The script I used was as follows.

<?php
$mysql_hostname = “localhost”;
$mysql_user = “root”;
$mysql_password = “abc123”;
$mysql_database = “testdb”;

$link = mysql_connect($mysql_hostname, $mysql_user, $mysql_password);
mysql_select_db($mysql_database,$link);
if (!$link) {
die(‘Could not connect: ‘ . mysql_error());
}
else
echo ‘Connected successfully’;
?>

Executing the script returned the following error.

root@abc:/var/www/html/scripts# php test.php
PHP Warning:  mysql_connect(): No such file or directory in /var/www/html/scripts/test.php on line 7
PHP Warning:  mysql_select_db() expects parameter 2 to be resource, boolean given in /var/www/html/...

Read More