Tuesday, June 28, 2011

Apache Userdir enabled

go to

In httpd.conf
add comment bellow line
userdir disabled
-----------------------------------------------
chmod 711 for /home/userdir(userid)
chmod 755 for /home/userdir(userid)/public_html

[or]

chcon -R -t htppd_sys_content_t /home/keval/web
-----------------------------------------------
system => selinux management => boolean
check => Allow httpdto read home directores(module apache)

[or]

setsebool -P httpd_enable_homedirs true
-----------------------------------------------
remove comment in httpd.conf
NameVirtualHost *:80


ServerName localhost
DocumentRoot /home/userdir/web

-----------------------------------------------
restart httpd
-----------------------------------------------

/etc/hosts

change localhost localhost.localdomain to localhost.localdomain localhost

127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain

replace with

127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost

-----------------------------------------------

Friday, May 27, 2011

Saurashtra University Result

How to recover / change the root password on RedHat Linux based systems

How to recover / change the root password on RedHat Linux based systems

Power on, or reboot as needed.

and press 'tab' key

Now you should press 'e' and you will get this screen.

plz select kernel option

now press 'e'

Insert an space and the number one '1'.

After that press ENTER and 'b' and ENTER again.

Now you can change the password like this

#passwd

enter new password

then

give

#chmod u+s /bin/su

and

#exit

Tuesday, April 19, 2011

Enable Remote Access To Mysql Database Server

By default remote access to MySQL database server is disabled for security reasons. However, some time you need to provide remote access to database server from home or a web server.

Working on fedora 10, php 5.3.2 and mysql Server version: 5.1.47

Edit my.cnf File
Red Hat Linux/Fedora/Centos Linux file is located at /etc/my.cnf location

opne this file and search [mysqld]
and add bellow line
port = 3306
bind-address = your system ip

service mysqld restart


Open port 3306


open TCP port 3306 using iptables.
A sample iptables rule to open Linux iptables firewall

/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT

save all rules

service iptables save

Example

<?php
$link = mysql_connect('host ip', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
exit;
}

$db_selected = mysql_select_db('database',$link);
if (!$db_selected) {
die ('Can\'t use database : ' . mysql_error());
exit;
}

$sql = "SELECT id as col1, col2, col3 FROM sometable";

$result = mysql_query($sql);

if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}

if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}

while ($row = mysql_fetch_assoc($result)) {
echo $row["col1"];
echo " ".$row["col2"];
echo " ".$row["col3"];
}

mysql_free_result($result);

mysql_close($link);
?>

Base on : http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

Thursday, April 7, 2011

windows desktop corrupted

if windows desktop corrupted

then copy explorer.exe from working windows folder to corrupted deskotp windows folder (same version)

Tuesday, March 8, 2011

mount nfs no route to host

in fedora os

first open

vi /etc/exports

add bellow line
/home/USER_NAME/public_html 192.168.1.*(rw,async,no_root_squash)


exportfs -a -v

service nfs start

chkconfig nfs on

service portmap restart

chkconfig portmap on

service iptables stop

(if you want to iptables service permanently disable)

/sbin/chkconfig iptables off

then after mount nfs from other system bellow command

mount -o rw,async 192.168.1.(server id):/home/USER_NAME/web /home/USERS_NAME/MOUNT_DIR_NAME

auto mount in booting (server  dir local sys dir)

192.168.1.1:/home/keval/web /home/keval/kevalweb nfs defaults 0 0

==============================
if ssh login not work on fedora

then try commnad through

passwd username

Monday, March 7, 2011

mysql data copy

start mysql

> mysql -h localhost -u root -p

create user

mysql> create user 'user_name'@'localhost' identified by 'password';

create database

mysql> create database db_name

use database

mysql> use db_name;

copy data from file

mysql> \. /home/user_name/Downloads/my_db.sql

how to see xml preview in browser php

xml preview view in browser $xml = new DOMDocument('1.0', 'UTF-8');                 $xml->preserveWhiteSpace = false; ...