Thursday, October 14, 2010

Mysql & php test page

mysql_connect("localhost", "user", "userpass") or die(mysql_error());
echo "Connected to MySQL
";
mysql_select_db("test") or die(mysql_error());
echo "Connected to Database";
?>

Wednesday, October 6, 2010

Apache Access Control with User/Password protected directories with MYSQL

 add the following to httpd.conf file 

     AuthType Basic
     AuthName " protected directories "
     AuthMySQLHost localhost
     AuthMySQLUser root
     AuthMySQLPassword  dbpassword
     AuthMySQLDB http_auth
     AuthMysqlUserTable  user_auth
     AuthMySQLNameField user_name
     AuthMySQLPasswordField user_passwd
     AuthMySQLNoPasswd Off
     AuthMySQLPwEncryption crypt
     AuthMySQLPwEncryption none
     AuthMySQLEnable on
     require valid-user
    


MYSQL
* mysql -h localhost -u root -ppassword
    * mysql> create database http_auth;
* mysql> use  http_auth;
    * mysql> create table user_auth ( user_name char(30) NOT NULL,user_passwd char(60) NOT NULL,user_group char(25),primary key (user_name) );
    * mysql> insert into user_auth values('Nikhil','supersecret','Admin');
and restart apache .....
 mod_auth_mysql*.*rpm need to be installed
And make sure this line is included in the conf file httpd.conf
LoadModule mysql_auth_module modules/mod_auth_mysql.so

Sunday, October 3, 2010

permanently bypass fsck

permanently bypass fsck check on any filesystem using tune2fs command as follows:
[root@node01 ~]# tune2fs -i 0 /dev/VolGroup00/LogVol00
tune2fs 1.39 (29-May-2006)
Setting interval between checks to 0 seconds
[root@node01 ~]#